feat(threads): show pending agent questions - #9583
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a cross-cutting agent-question workflow with new authenticated MCP mutation tools, persistent orchestration state, and changes to snoozing, settlement, credential routing, and web/mobile status behavior. Unresolved lifecycle concerns include stale attention updates and question markers being cleared after later session failures. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
Follow-up commit |
| type: "thread.attention-set", | ||
| payload: { | ||
| threadId: command.threadId, | ||
| attention: unchanged ? thread.attention! : command.attention, |
There was a problem hiding this comment.
🟡 Medium orchestration/decider.ts:1530
A delayed thread.attention.set can restore an old question after a newer thread.turn.start already cleared it, so the thread is incorrectly marked as awaiting input and is blocked from snoozing or automatic settlement. Likewise, thread.attention.clear and thread.revert.complete unconditionally clear the current marker, allowing stale clears (including zero-turn reverts) to hide a newer unanswered question. Add request/turn generation checks to all three paths so they only modify the attention marker they correspond to.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/orchestration/decider.ts around line 1530:
A delayed `thread.attention.set` can restore an old `question` after a newer `thread.turn.start` already cleared it, so the thread is incorrectly marked as awaiting input and is blocked from snoozing or automatic settlement. Likewise, `thread.attention.clear` and `thread.revert.complete` unconditionally clear the current marker, allowing stale clears (including zero-turn reverts) to hide a newer unanswered question. Add request/turn generation checks to all three paths so they only modify the attention marker they correspond to.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bb2bc1a. Configure here.
| threadId: command.threadId, | ||
| updatedAt: command.createdAt, | ||
| }, | ||
| } |
There was a problem hiding this comment.
Errors wipe delivered question markers
Medium Severity
A thread.session.set to error or interrupted always clears attention, even after the question was delivered and the session had already gone ready. A later provider runtime.error or session crash therefore drops the sidebar marker and leaves the unanswered thread eligible for auto-settle.
Reviewed by Cursor Bugbot for commit bb2bc1a. Configure here.
## What Changed - Ports [upstream PR pingdotgg#9583](pingdotgg#9583), including upstream commits `bbd8995b3c` and `9993263aee`. - Adds authenticated, thread-scoped `set_thread_attention` and `clear_thread_attention` tools to the existing `t3-code` MCP server. - Shows a bare violet `?` in compact sidebars and `? Question` where long labels fit, across web/desktop and mobile. - Clears the marker on the user's next reply or explicit settlement; automatic settlement waits for it to clear. - Enforces the attention-only MCP endpoint when agent browser access is disabled and records the real question timestamp for snooze wake indicators. ## LastCode Adaptations - Preserves LastCode's action-resume MCP tools and its existing `Waiting` status priority. - Preserves thread annotations, persistent threads, latest-user-message tracking, and worktree-cleanup projections. - Uses migration 57 because LastCode already owns migrations 48–56. - Keeps the full MCP endpoint limited to preview-capable credentials while exposing only thread-attention tools on `/mcp/thread`. ## Why Interview-style agent workflows can end on a blocking question while looking indistinguishable from completed threads. The explicit MCP signal is reliable and authenticated to the current thread, unlike parsing provider terminal output. A discriminated attention record keeps the initial UI narrow while allowing additional user-actionable kinds later without another persistence redesign. ## UI Changes Before: a blocking agent question fell back to the thread timestamp. After: the row shows a bare violet `?`, plus `Question` in layouts with long status labels. Native input continues to show `Input` / `Awaiting Input`. Live web QA covered desktop and responsive sidebar layouts in dark mode. The visual artifact is intentionally not committed to the repository. ## Validation - 14 affected test files passed; the final MCP/snooze follow-up added 39 passing tests in its focused run. - LastCode Quick CI passed at `d3df114d24` (format, lint with no errors, and all 15 workspace typechecks). - Live web QA passed for desktop and responsive layouts. Implemented with GPT-5.6-Sol in the T3 Code Codex harness.


What Changed
questionkind.set_thread_attentionandclear_thread_attentiontools to the existingt3-codeMCP server.?in compact sidebars and? Questionwhere long labels fit, across web/desktop and mobile.Why
Interview-style agent workflows can end on a blocking question while looking indistinguishable from completed threads. The explicit MCP signal is reliable and authenticated to the current thread, unlike parsing provider terminal output. A discriminated attention record keeps the initial UI narrow while allowing additional user-actionable kinds later without another persistence redesign.
UI Changes
Before: a blocking agent question fell back to the thread timestamp.
After: the row shows a bare violet
?, plusQuestionin layouts with long status labels. Native input continues to showInput/Awaiting Input.Live web QA covered both desktop and responsive sidebar layouts in dark mode. The visual artifact is intentionally not committed to the repository.
Validation
Checklist
Implemented with GPT-5.6-Sol in the T3 Code Codex harness.
Note
Medium Risk
Touches orchestration lifecycle, MCP auth/capabilities, and settlement/snooze invariants; behavior changes when preview is disabled (attention MCP remains available).
Overview
Adds a
questionthread attention marker agents can raise when a blocking question would otherwise look like a finished thread. Contracts, orchestration commands/events, projection (attention_jsonmigration), and shell snapshots all carry optionalattention.Agents set or clear it through new MCP tools
set_thread_attention/clear_thread_attention, bound to the authenticated thread. Preview tools stay on/mcp; attention-only credentials use/mcp/threadwhen agent browser access is off—sessions still get MCP, but without preview capability instead of withholding credentials entirely.Orchestration treats attention like other “needs you” work: setting it wakes settled/snoozed threads; snooze and auto-settle are blocked; manual settle clears it; a user reply clears it before turn start. Web, mobile, and client-runtime status/snooze logic show a violet
?/ Question below approval and native input priority.User-facing docs in
thread-sidebar.mddescribe the marker and how it differs from provider approval/input prompts.Reviewed by Cursor Bugbot for commit bb2bc1a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add pending agent question attention to threads with
thread.attention.setandthread.attention.clearThreadAttentioncontract type with aquestionkind andraisedAttimestamp, plusattentionfields onOrchestrationThreadandOrchestrationThreadShell, internal set/clear commands, andthread.attention-set/thread.attention-clearedevents in orchestration.tsattention_jsonnullable column) and returns it through snapshot queries and the projector in ProjectionSnapshotQuery.ts and projector.tsset_thread_attentionandclear_thread_attentionMCP tools through a new/mcp/threadendpoint that accepts attention-only credentials without the preview capability, while the existing/mcpendpoint now serves both preview and attention toolkits in McpHttpServer.tsQuestionstatus pill with a question-mark icon when a thread has question attention, ranked below pending approval/user-input but above active work, in Sidebar.logic.ts and threadListV2.tscanSnoozein threadSettled.ts now returnsfalsefor threads with question attention;prepareMcpSessionin ProviderService.ts always requests an MCP credential instead of revoking one when agent-browser-access is disabledMacroscope summarized bb2bc1a.