Skip to content

fix(runtime-api): project dynamic tool-result cancellation through the SSE compat stream - #6849

Merged
Hmbown merged 3 commits into
codewhale-hq:mainfrom
asto18089:upstream/sse-cancelled-projection
Oct 6, 2026
Merged

Hmbown merged 3 commits into
codewhale-hq:mainfrom
asto18089:upstream/sse-cancelled-projection

Conversation

@asto18089

@asto18089 asto18089 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When a turn is interrupted while an external approval is pending, the resolution is published as approval.decided with decision: "deny" plus cancelled: true, so consumers can tell "nobody answered" apart from a refusal. The SSE compatibility projection forwarded timeout but dropped cancelled, so SSE clients saw an ordinary deny and kept a pending prompt tied to a dead turn.

Forward cancelled alongside timeout in the approval.decided compat arm, pin both shapes in the compat-mapping test, and document the two flags in the compatibility-stream section of docs/RUNTIME_API.md.

Testing

  • cargo test -p codewhale-tui --lib stream_compat — a cancelled: true payload now projects the flag through the SSE frame; the assertion fails without the projection change; approval.timeout projections unchanged
  • cargo clippy -p codewhale-tui --all-targets --all-features --locked

Disclosures: the projection is payload-driven and forward-compatible; the test pins the mapping, not a real end-to-end interrupt.

Adapted from the Pinvou fork's timeout audit (Pinvou/CodeWhale d349f2537), renamed to upstream's cancelled flag (the fork's original called it interrupted).

Checklist

  • Updated docs or comments as needed (docs/RUNTIME_API.md)
  • Added or updated tests where relevant
  • No CHANGELOG.md changes

No-Issue: bounded SSE compatibility correction submitted directly as this contributor PR.

…e SSE compat stream

When a turn is interrupted (or its engine goes away) while an external
tool call is pending, the resolution is published as `approval.decided`
with `decision: "deny"` plus a `cancelled: true` flag, so consumers can
tell "nobody answered this" apart from a refusal. The SSE compat
projection already forwarded the `timeout` resolution flag but dropped
`cancelled`, so an SSE client watching the compatibility stream saw an
ordinary deny: pending UI stayed tied to a call whose turn no longer
exists, or a cancellation read as the operator refusing the call.

Forward `cancelled` alongside `timeout` in the projection, pin both
shapes in the compat-mapping test, and document the two flags in the
compatibility stream section of docs/RUNTIME_API.md.

Signed-off-by: asto <asto18089@126.com>
@asto18089
asto18089 requested a review from Hmbown as a code owner October 5, 2026 11:51
@github-actions github-actions Bot added the contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm label Oct 5, 2026
@Hmbown Hmbown added this to the v0.10.2 milestone Oct 5, 2026
@Hmbown
Hmbown merged commit ecbf286 into codewhale-hq:main Oct 6, 2026
64 of 76 checks passed
Hmbown pushed a commit that referenced this pull request Oct 6, 2026
Picks up #6849 (SSE cancel projection) and #6850 (agent wait
disclosure). The parent-surface byte ceiling carries both sides:
wave's description rewrites (90,121B) plus #6850's +222B wait-bound
disclosure, with the standing Linux margin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants