Skip to content

fix(query): stop background agent on monitor cancellation - #365

Merged
BunsDev merged 1 commit into
mainfrom
fix/background-agent-cancellation
Oct 18, 2026
Merged

BunsDev merged 1 commit into
mainfrom
fix/background-agent-cancellation

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Make monitor cancellation stop a running background subagent query.

Context

  • Related user request: Goal 3 query agent cancellation ownership audit.
  • Scope: background AgentTool tasks and the task registry's terminal cancellation transition.
  • Non-goals: foreground agent calls, scheduled queries, and blocking tools that do not respond to query cancellation.

Changes

  • Store a runtime-only cancellation token with a background task; it remains absent from serialized task metadata.
  • Give the background agent's query the same token. A winning registry cancellation now signals the query; completion or a losing cancellation does not.
  • Add an isolated local HTTP regression. Before the change, monitor reported cancellation while the agent request remained open; afterward it closed. Add a registry terminal race control.

Validation

  • git diff --check: passed.
  • cargo fmt --all -- --check: passed.
  • CARGO_TARGET_DIR=/tmp/coven-code-goal3-acp-target cargo test --package claurst-core --test task_terminal --locked: passed.
  • CARGO_TARGET_DIR=/tmp/coven-code-goal3-acp-target cargo test --package claurst-query --lib monitor_cancel_stops_background_agent_request --locked: passed; failed before the code change.
  • CARGO_TARGET_DIR=/tmp/coven-code-goal3-acp-target cargo check --workspace --all-targets --locked: passed.
  • CARGO_TARGET_DIR=/tmp/coven-code-goal3-acp-target cargo clippy --workspace --all-targets --locked -- -D warnings: passed.
  • CARGO_TARGET_DIR=/tmp/coven-code-goal3-acp-target cargo test --workspace --locked: passed.
  • scripts/tui-tests/run.sh: N/A; no TUI or input changes.

PR Readiness

  • Diff is limited to the intended files.
  • Generated files were not edited by hand.
  • User-facing docs/help were updated or are not needed.
  • No secrets, credentials, or unrelated logs are included; validation names only a scratch target path.
  • Remaining risks or follow-up work are listed above.

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 18, 2026 6:41am UTC

Request Review

@BunsDev

BunsDev commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

Reviewed task registry cancellation and the background agent producer, including the local HTTP cancellation regression and terminal-state control. All eight head checks passed; whitespace and merge-tree checks passed after #357 landed. Composition retains the Debug redaction and adds only the reviewed runtime token changes to core. Registry cancellation signals execution; it is not a cleanup-completion receipt. #366 remains blocked on #374. Verification relies on hosted Rust checks; no fresh local Cargo run was performed.

@BunsDev
BunsDev deleted the fix/background-agent-cancellation branch October 18, 2026 08:31

This branch was successfully deployed

1 active deployment
Preview — 650ab33f Deployed Oct 18, 2026 by vercel[bot]
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