fix(web): flow cancel's non-interactive refusal serves a page - #346
Merged
Conversation
`capy flow cancel <id> --web` exited 3 with no URL. The refusal itself was
correct — loud, and it names the remedy — but under --web it reached nobody.
displayErrorAndExit is the wrong tool here: it hardcodes exit 1, and this
refusal's contract is EXIT_NEEDS_INPUT (3), the code an agent branches on to
learn that a question needs answering. So the page is served directly and the
exit code is preserved. The sentences are refuseNonInteractive's own, carried
whole, so terminal and browser say the same thing.
Fixed at this call site rather than inside refuseNonInteractive, deliberately.
The central fix would cover all 13 call sites at once, but it means making that
function async — and it is typed `never`, which is what every caller relies on
for control flow. An unawaited async call would let execution continue past a
guard that is supposed to stop it, silently. That is a real refactor with a
real failure mode, not a mechanical change, and it should be done deliberately
rather than at the end of a long session.
Verified by running:
$ capy flow cancel <id> --web
exit code: 3
url line : http://127.0.0.1:50613/s/8dEYIfWQLnt8_w9Rlo05UliRoM1baGKz_FhhV4LBaXY
Suite: 1851 pass, 0 fail.
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.
capy flow cancel <id> --webexited 3 with no URL. The refusal itself was correct — loud, names the remedy — but under--webit reached nobody.displayErrorAndExitis the wrong tool: it hardcodes exit 1, and this refusal's contract isEXIT_NEEDS_INPUT(3), the code an agent branches on to learn a question needs answering. So the page is served directly and the exit code is preserved. The sentences arerefuseNonInteractive's own, carried whole.Verified by running:
Why here and not in
refuseNonInteractiveThe central fix would cover all 13 call sites at once. But it means making that function
async— and it is typednever, which every caller relies on for control flow. An unawaited async call would let execution continue past a guard meant to stop it, silently. That is a real refactor with a real failure mode, not a mechanical change, and it deserves to be done deliberately. Written up in the handoff rather than half-built.Suite: 1851 pass, 0 fail.