Skip to content

test(channels): drive a refused prompt through the bridge runner - #782

Merged
huichen merged 1 commit into
mainfrom
test/chan-turn-error-arm
Sep 22, 2026
Merged

huichen merged 1 commit into
mainfrom
test/chan-turn-error-arm

Conversation

@huichen

@huichen huichen commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

test(channels): drive a refused prompt through the bridge runner

The Err arm of the bridge runner — the warning logged when a turn fails
after the connection is already held — had no test that reached it on purpose.

bridge/turn.rs does test a refused prompt, but it calls run_turn directly,
so it never enters the runner's error arm; and the two bridge tests that point
at a dead endpoint fail at client() first, taking the "cannot reach the agent"
path instead. The result was an arm whose coverage depended on the run: it read
as covered in one full-suite measurement and uncovered in the next.

a_turn_that_cannot_be_dispatched_is_logged_and_leaves_the_bridge_routable
removes the ambiguity: the agent is reachable (so the bridge holds a connection)
and refuses the prompt command, which is the only shape that makes run_turn
return Err while the connection is healthy. Verified by instrumenting that
single test — bridge/mod.rs lines 252–254 execute, 1 rather than 0.

It also pins the behaviour that arm exists for: a refused turn is explained to
the user, the healthy connection is kept rather than torn down, and the
conversation stays routable.

The `Err` arm of the bridge runner — the warning logged when a turn fails
after the connection is already held — had no test that reached it on purpose.

`bridge/turn.rs` does test a refused prompt, but it calls `run_turn` directly,
so it never enters the runner's error arm; and the two bridge tests that point
at a dead endpoint fail at `client()` first, taking the "cannot reach the agent"
path instead. The result was an arm whose coverage depended on the run: it read
as covered in one full-suite measurement and uncovered in the next.

`a_turn_that_cannot_be_dispatched_is_logged_and_leaves_the_bridge_routable`
removes the ambiguity: the agent is reachable (so the bridge holds a connection)
and refuses the `prompt` command, which is the only shape that makes `run_turn`
return `Err` while the connection is healthy. Verified by instrumenting that
single test — `bridge/mod.rs` lines 252–254 execute, `1` rather than `0`.

It also pins the behaviour that arm exists for: a refused turn is explained to
the user, the healthy connection is kept rather than torn down, and the
conversation stays routable.
@huichen
huichen enabled auto-merge (squash) September 22, 2026 16:35
@huichen
huichen merged commit 6a44f4e into main Sep 22, 2026
12 checks passed
@huichen
huichen deleted the test/chan-turn-error-arm branch September 22, 2026 16:39
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