Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Capacitor.Cli.Core/Harness/Claude/ClaudeChatRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public IReadOnlyList<RunSignal> Runs(CanonicalEvent evt, AcpEventEnvelope raw) {
case "completed": outcome = RunOutcome.Done; break;
case "failed": outcome = RunOutcome.Failed; break;
case "killed": outcome = RunOutcome.Stopped; break;
case "stopped": outcome = RunOutcome.Stopped; break;
default: return [];
}
return [new RunSignal.Finished(callId, agentId, outcome, evt.Timestamp)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,17 @@ public async Task A_notification_cut_off_before_its_closing_tag_still_finishes()
await Assert.That(finished.Outcome).IsNull();
}

/// A resumed Claude Code reports a background agent the previous process left running this way:
/// keyed by the agent id alone, with a status of its own.
Comment thread
alexeyzimarev marked this conversation as resolved.
[Test]
public async Task A_notification_for_an_agent_the_previous_process_left_running_finishes_it_as_stopped() {
var line = """{"type":"user","timestamp":"2026-10-22T13:42:55.148Z","origin":{"kind":"task-notification"},"promptSource":"system","message":{"role":"user","content":"<task-notification>\n<task-id>a9202cd3d93195cce</task-id>\n<output-file>/tmp/a9202cd3d93195cce.output</output-file>\n<status>stopped</status>\n<summary>Background agent \"Review Task 12 (spec + quality)\" didn't finish before the previous session ended</summary>\n<note>No completion record was found for it in the previous session.</note>\n</task-notification>"}}""";
var finished = (RunSignal.Finished)R(line).Runs.Single();
await Assert.That(finished.CallId).IsNull();
await Assert.That(finished.AgentId).IsEqualTo("a9202cd3d93195cce");
await Assert.That(finished.Outcome).IsEqualTo(RunOutcome.Stopped);
}

[Test]
public async Task A_notification_status_is_matched_without_regard_to_case() {
var finished = (RunSignal.Finished)R(Notification(originKind: true, status: "Completed")).Runs.Single();
Expand Down
Loading