Skip to content

fix(ask-user): gate a partial answer to a multi-question required call - #6283

Open
surlymochan wants to merge 3 commits into
code-yeongyu:mainfrom
surlymochan:fix/2966-ask-user-required-partial-gate
Open

surlymochan wants to merge 3 commits into
code-yeongyu:mainfrom
surlymochan:fix/2966-ask-user-required-partial-gate

Conversation

@surlymochan

@surlymochan surlymochan commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2966.

Gap 1 — partial answer to a required multi-question call

formatBody only took the gated branch for settlements other than answered/comment-submitted, so a required call that settled as answered with some questions still in unanswered read as an ordinary partial answer ("Unanswered: ...") with no instruction to hold the gated action. Now a required call with any unanswered question renders the refusal ("The user answered only part of the question." + the answered lines + "Unanswered: ..." + "No answer: do not take the action it gates. ..."). A fully answered required call is unchanged, and non-required partial answers render exactly as before.

Gap 2 — restart pass-through test

settleUnrestorable already carries required onto the orphaned request, but nothing tested it. Added a resume test: a required call whose recorded arguments can no longer form a valid request (zero questions) is resumed and the delivered frame is asserted to contain the refusal and not "continue on best judgment". The test fails if the pass-through is removed (verified by mutation).

Tests

  • New test/suite/regressions/2966-ask-user-required-partial-gate.test.ts: RED before the fix (2 failed), GREEN after (4 passed).
  • New resume test in test/suite/ask-user-resume.test.ts: 16 passed; mutation check (pass-through removed) fails with the old "continue on best judgment" text.
  • Neighbouring suites (2949-required-question-gate, ask-user cancel suites): passed.
  • bun run check (lint + fmt + tsc + gates): clean.

Notes

  • CLA: pending user signature (per sprint note; not signed by the contributor).
  • Change fragment (changes/unreleased/<pr-number>.md, tracker + changelog blocks) to follow once the PR number is assigned.

Summary by cubic

Fixes #2966. A required multi-question ask-user call that settles as answered or comment-submitted with some questions unanswered now refuses the gated action and names the unanswered questions, instead of reading as an ordinary partial answer with no instruction to hold the action. Fully answered required calls and non-required partial renderings are unchanged.

Also handles the comment-only reply to a required question: it stays gated, keeps the user's comment in the rendering and in the model's words, and its reason line says the question went unanswered instead of claiming a partial answer. A partial gated rendering now ends with a partial-specific closing line that names the still-gating question, rather than the contradictory No answer: line.

  • Adjusts formatBody and formatGatedNoAnswer in packages/coding-agent/src/core/extensions/builtin/ask-user/format.ts to gate required partial answers.
  • Adds a resume test verifying that a required call that cannot be restored still refuses on resume, plus regression tests for the refusal, the comment-only case, and the unchanged non-required output.
  • Adds a changelog fragment under changes/unreleased/6283.md.

Written for commit c828731. Summary will update on new commits.

View guided diff

@code-yeongyu

Copy link
Copy Markdown
Owner

Thanks @surlymochan. Gating a partial answer to a required multi-question call is the right idea, but the new gate drops the user's own words in one common case.

Needs a change: ask-user/format.ts:123-124,165-168 sends every required comment-submitted response with a non-empty unanswered to formatGatedNoAnswer, and that function never renders response.comment (format.ts:135-146). pending.ts:192-196 settles any submit with a comment as comment-submitted, with every unselected question in unanswered, so a comment-only reply always hits the gate, even on a single-question required call. That's a documented path (session-control comment-only frames, the async widget draft comment, RPC). The user's words then vanish from both the model text and words (the base keeps them as a labelled user-word block; this head returns words: []), and the model is told "The user answered only part of the question", which is false when nothing was selected. On the multi-question partial case the comment is dropped too, and the new test (2966-ask-user-required-partial-gate.test.ts:36-41,55-68) doesn't assert the comment survives.

Keeping the comment in the gated rendering (the words.comment(...) line, as formatBody's comment-submitted branch does) fixes the loss. Please also decide explicitly whether a comment-only reply to a required question should gate at all, and if it does, give it an accurate reason line.

Smaller: the partial rendering lists the real answers and then ends with the shared GATED_NO_ANSWER line starting "No answer:", which contradicts the answers above it; a partial-specific line would read cleanly.

A comment-only reply to a required question still gates the action, but
the gated rendering dropped the comment and ended with the contradictory
'No answer:' line. The reason now says what actually happened
(comment-only / partial / unanswered), the comment renders exactly as the
non-gated branch renders it, and a partial gate closes with its own
'The unanswered question still gates the action ... Keep that action
pending and end the turn.' line.

Follow-up for code-yeongyu#6283, addressing code-yeongyu's 2026-11-09 review.
@surlymochan

Copy link
Copy Markdown
Contributor Author

Addressed in c828731 (just pushed).

Decision: a comment-only reply still gates the action — a comment is not an answer to the gated question, so the action stays pending until the question is really answered. But the gated rendering no longer drops the comment or contradicts itself:

  • The reason line is now case-specific: partial with answers / comment-only / nothing answered.
  • A submitted comment renders after the reason, exactly as the non-gated comment-submitted branch renders it.
  • A partial gate closes with its own line — "The unanswered question still gates the action: do not take the action it gates until it is answered. Keep that action pending and end the turn." — instead of sharing GATED_NO_ANSWER's "No answer:".

Tests: 3 new cases in 2966-ask-user-required-partial-gate.test.ts (failed before the fix, 7/7 after; 123/123 across the ask-user regression files), bun run check clean, mock-loop self-test 47/48 (the single billing-swap failure reproduces on the base commit, unrelated to this change).

This branch has not been deployed

No deployments
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.

ask-user required: gate a partial answer to a multi-question call, and test the restart pass-through (follow-up to #2959)

2 participants