Skip to content

fix(process): agent-requested kill/remove is success, not "⚠️ failed" (ENG-15627 §5b) - #51

Closed
monac24 wants to merge 1 commit into
boonfrom
eng-15627-operation-outcome
Closed

monac24 wants to merge 1 commit into
boonfrom
eng-15627-operation-outcome

Conversation

@monac24

@monac24 monac24 commented Jul 15, 2026 •

Copy link
Copy Markdown

Related: ENG-15627 (§5b — operation-outcome vs session-state)

What Problem This Solves

Fixes an issue where an agent that intentionally kills or removes a background process it started sees "⚠️ 🧰 Process failed" in the chat channel — for a deliberate, successful teardown. As Mona flagged: the runtime reports the mechanical outcome of one operation with zero knowledge of the agent's intent. A successful, agent-requested termination is not a failure, but it was labeled one.

Why This Change Was Made

The process tool's kill and remove success paths returned details.status: "failed", and the SIGKILL fallback recorded the session as "failed". isToolResultError — the exact predicate that drives the ⚠️ banner — treats "failed" as an error, so the deliberate teardown surfaced as a failure.

  • kill success → details.status: "completed" (was "failed").
  • remove success → details.status: "completed" (was "failed").
  • SIGKILL fallback records the session as "killed" (agent-requested) rather than "failed" on both paths — more truthful, and killed remains a non-success status for later poll/status views (unchanged there, no regression).
  • Genuine failures (no active supervisor run / no pid, session not backgrounded) still return failText → failed.

Scoped: this is the concrete, highest-signal instance of the §5b operation-outcome model. The full OperationOutcome type (disposition/agency/terminality) and deleting the helpers text-sniffing are a larger follow-up; this fixes the specific customer-visible lie now.

User Impact

An agent tearing down its own backgrounded session (e.g. after a long-running command finishes, or cancelling a tunnel/dev-server) no longer emits a false "⚠️ Process failed" to the user. Real failures are unchanged.

Evidence

  • TDD: RED (successful kill classified as error) → GREEN, for both kill and remove, asserted via isToolResultError(result) === false — the same predicate that renders the ⚠️ banner.
  • Updated the SIGKILL-fallback test to assert the truthful status: "killed".
  • Full agents-tools shard green (989 tests); process suites (20 tests) green; oxlint clean.

🤖 Generated with Claude Code


Summary by cubic

Marks agent‑requested kill/remove of background processes as successful instead of failed, preventing the false “⚠️ 🧰 Process failed” banner. SIGKILL fallback now records “killed”; genuine failures are unchanged. Addresses ENG-15627 §5b by aligning operation outcome with agent intent.

  • Bug Fixes
    • kill success returns details.status: "completed" (was "failed").
    • remove success returns details.status: "completed" (was "failed").
    • SIGKILL fallback records session state as "killed" (not "failed").
    • Tests assert isToolResultError(result) === false for successful kill/remove and verify fallback state.

Written for commit 4955b22. Summary will update on new commits.

Review in cubic

… (ENG-15627 §5b)

The process tool's `kill` and `remove` success paths returned
details.status:"failed", and the SIGKILL fallback recorded the session as
"failed". isToolResultError treats "failed" as an error, so a deliberate,
successful agent-requested teardown rendered "⚠️ 🧰 Process failed" in the
channel — reporting the mechanical outcome with no knowledge of the agent's
intent (the operation-outcome-vs-session-state problem in the ENG-15627 spec
§5b).

- kill success → details.status:"completed" (was "failed"); a genuine
  inability to terminate still returns via failText earlier.
- remove success → details.status:"completed" (was "failed").
- SIGKILL fallback records the session as "killed" (agent-requested), not
  "failed", on both paths.

Tests assert isToolResultError(result) === false for successful kill/remove
(the exact predicate that drives the ⚠️ banner) and that the fallback records
status:"killed". The genuine-failure paths (no pid, not backgrounded) still
return failed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@claude

claude Bot commented Jul 15, 2026

Copy link
Copy Markdown

Claude Code is working…

I'll analyze this and get back to you.

View job run

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@monac24

monac24 commented Jul 16, 2026

Copy link
Copy Markdown
Author

Superseded by #53 — consolidated with the G4 non-terminal-tool-error fix into one reviewable unit (both are the same §5b operation-outcome theme).

@monac24 monac24 closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant