Skip to content

fix(web): stop dismissing questions after a 60 second timeout#1059

Closed
wbxl2000 wants to merge 2 commits into
mainfrom
fix/web-question-timeout
Closed

fix(web): stop dismissing questions after a 60 second timeout#1059
wbxl2000 wants to merge 2 commits into
mainfrom
fix/web-question-timeout

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No prior issue. Follow-up to #1056 — found while reviewing the AskUserQuestion path after fixing the web yolo auto-approve.

Problem

In the web UI, an AskUserQuestion request was silently dismissed if the user did not answer within 60 seconds. The server's question broker started a 60s timer per question and, on expiry, rejected it, which surfaced to the agent as "user dismissed the question without answering." This made questions unreliable whenever the user needed more than a minute to respond.

What changed

  • Removed the 60s timeout from the server's question broker; a question now stays pending until the user answers or explicitly dismisses it.
  • Removed the now-unused expires_at field from the question request (protocol, agent-core adapter, and web client types) and the event.question.expired emission/handling.
  • Added an abort cleanup path: the turn's abort signal is now threaded to the question broker, and the pending question is dismissed (and removed from the web UI) when the turn is aborted. Previously, aborting only cancelled the agent-side RPC call, leaving the broker entry stuck in _pending and the session in awaiting_question until manual dismiss or shutdown (the removed timer had been the only automatic cleanup).
  • Updated the affected tests (removed the obsolete timeout tests; added an abort-cleanup test; the remaining question tests still cover resolve, dismiss, and recovery).

Approvals keep their existing 60s timeout — this change is scoped to questions only. The QUESTION_EXPIRED protocol error code is left in place (now unused) to avoid a protocol-level removal in this PR; happy to drop it in a follow-up if preferred.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

The server's question broker auto-expired AskUserQuestion requests after 60s, which dismissed the question even when the user simply needed more time. Remove the timeout, and the now-unused expires_at field, so a question stays pending until the user answers or explicitly dismisses it.
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4cee9b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@4cee9b0
npx https://pkg.pr.new/@moonshot-ai/kimi-code@4cee9b0

commit: 4cee9b0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2159c20e29

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 105 to 107
return new Promise<QuestionResult>((resolve, reject) => {
const timer = setTimeout(() => this._expire(questionId), this._timeoutMs);
timer.unref?.();
this._pending.set(
questionId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear pending questions when the turn is aborted

When a user aborts a prompt while AskUserQuestion is waiting, PromptService.abort() only cancels the agent-side RPC call; it does not settle this broker entry. The removed timer was the only remaining automatic cleanup, so the PendingQuestion now stays in _pending indefinitely, causing listPending()/session status to remain awaiting_question until the user manually dismisses the stale card or the server shuts down. Please add an abort/session cleanup path when removing the timeout.

Useful? React with 👍 / 👎.

When a prompt is aborted while an AskUserQuestion is pending, the agent's RPC call is cancelled but the broker entry was never settled, so it stayed in _pending and kept the session in awaiting_question until manual dismiss or shutdown. Thread the turn's abort signal to the question broker and dismiss the pending question when it fires.
@wbxl2000 wbxl2000 closed this Jun 25, 2026
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