test(app-server): cover external-agent cancellation and approval paths#187
Open
andrei-hasna wants to merge 3 commits into
Open
test(app-server): cover external-agent cancellation and approval paths#187andrei-hasna wants to merge 3 commits into
andrei-hasna wants to merge 3 commits into
Conversation
Add regression coverage for the live external-agent host and cancel RPC before /external-agent execution is ungated. These assert the current deny/reject gating so it cannot silently regress. Unit tests (thread_external_agent_processor): - terminal events (Completed/Failed/Cancelled) mark the run terminal so execute() does not double-emit Failed; progress events do not. - terminal events with no subscribers are dropped yet still recorded. - events fan out to every subscribed connection (late-event gating). - request_permission denies by default (RejectOnce). - perform_action rejects managed actions with the gating reason and emits a ProposedAction notification (action-routing-failure guard). - is_cancelled tracks the CancellationToken. Integration tests (suite/v2/thread_external_agent): - cancel rejects empty and unknown run ids with the expected messages. - an active run reaches a terminal event and is removed from the active-run registry so a follow-up cancel reports it inactive.
andrei-hasna
force-pushed
the
openloops/open-codewith/5ddd56e4-0f42-4530-9707-6c8b70630e33-8a59d29e
branch
from
July 9, 2026 13:00
864038b to
e55eb11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds regression coverage for live external-agent runs before
/external-agentexecution is ungated, per todos task5ddd56e4. Tests only — no product behavior changes; the current deny/reject gating is asserted as a regression guard.Unit tests (
thread_external_agent_processor)Completed/Failed/Cancelled) mark the run terminal (soexecute()cannot double-emitFailed); progress events (Status/ProposedAction) do not.request_permissiondenies by default (RejectOnce) — approval-denial guard.perform_actionrejects managed actions with the exact gating reason and emits aProposedActionnotification — action-routing-failure guard.is_cancelledtracks theCancellationToken.Integration tests (
suite/v2/thread_external_agent)CancelledorFailedso the registry-cleanup guarantee holds regardless of sandbox availability.Validation
cargo test -p codex-app-server --lib external_agent— 63 passed.cargo test -p codex-app-server --test all thread_external_agent_cancel— 2 new integration tests pass.cargo fmt --all,cargo clippy -p codex-app-server --all-targets— clean.Note: the pre-existing
thread_external_agent_start_emits_run_event_and_validates_runtimetest asserts theclauderuntime is gated on "missing runtime"; it fails in environments where a realclaudebinary is onPATH. This is environment-dependent and untouched by this change.🤖 Generated with Claude Code