Repository navigation
feat(server): add fail-open turn-end output gate on agent wakes + silent_ack (CLO-1248 part 3) - #227
Merged
Conversation
…ilent_ack (CLO-1248 part 3)
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Owner
Author
{
"reviewed_base": "51045b024c3d192686b3e7abf159381694afc603",
"reviewed_head": "6e2110aefd3b38a4753a7e733445c7e5f494c0cb",
"reviewer": "Gemini 4 Neon, Antigravity",
"author_session": "t3-thread:6a6b870263499e5c3c4ceec5efb20d31b46884a74e0c45beedb1a4cddb9ac991",
"reviewer_session": "antigravity:7d2b601a-ba93-40ec-9da6-1bf09602424c",
"fresh_context": true,
"review_kind": "full",
"round_id": "antigravity:7d2b601a-ba93-40ec-9da6-1bf09602424c",
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "important",
"file": "apps/server/src/orchestration-v2/AgentOutputGate.ts",
"line": 39,
"summary": "isExplicitChannelToolName fails to match silent_ack and ask_agent for non-`__` provider prefixes (e.g. Antigravity mcp_t3-code_silent_ack, Codex/Cursor t3-code.silent_ack, OpenCode t3-code-<thread>_silent_ack) because neither tool is registered in T3_MCP_TOOLS (so resolveT3McpToolId returns null) and the fallback loop only checks endsWith(`__${id}`). Agents on those providers calling silent_ack or ask_agent will be falsely bounced.",
"outcome": "open"
},
{
"id": "F2",
"severity": "important",
"file": "apps/server/src/orchestration-v2/AgentOutputGate.ts",
"line": 136,
"summary": "evaluateAgentOutputGate counts any dynamic_tool item with status === \"completed\" as an explicit channel delivery without checking whether the tool returned an error (compactDynamicToolOutput(item.output)?.isError). Because send_to_user, silent_ack, t3_thread_send, t3_thread_send_attachments, and ask_agent all use failureMode: \"return\", a failed call still lands as status === \"completed\" and falsely bypasses the output gate.",
"outcome": "open"
},
{
"id": "F3",
"severity": "important",
"file": "apps/server/src/orchestration-v2/AgentOutputGateReactor.ts",
"line": 110,
"summary": "The bounce dispatch uses notification.source.kind === \"system\" with creationSource: \"server\", which Orchestrator.ts:8994 classifies as delegationReminder and promotes to steer_active into any currently running turn. If a new run (including a human origin: \"user\" turn) starts before the async queue processes the completed agent run, the output-gate bounce prompt is steered mid-turn into the unrelated active run.",
"outcome": "open"
},
{
"id": "F4",
"severity": "nit",
"file": "apps/server/src/orchestration-v2/AgentOutputGate.ts",
"line": 118,
"summary": "evaluateAgentOutputGate does not check thread.settledOverride === \"settled\"; if an agent self-settled the thread during the wake (or a founder settled it before the async bounce runs), Orchestrator.ts:8521 will emit thread.unsettled when the bounce message is dispatched.",
"outcome": "open"
}
]
}Independent Review Summary (
|
Owner
Author
{
"reviewed_base": "51045b024c3d192686b3e7abf159381694afc603",
"reviewed_head": "ed6b822d3c3afdd7b3819684be9f4ba22f69400f",
"reviewer": "Gemini 4 Neon, Antigravity",
"author_session": "t3-thread:6a6b870263499e5c3c4ceec5efb20d31b46884a74e0c45beedb1a4cddb9ac991",
"reviewer_session": "antigravity:0b287bfa-8cce-468b-ba9a-66ee00dd364b",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "antigravity:7d2b601a-ba93-40ec-9da6-1bf09602424c",
"prior_findings": [
{
"id": "F1",
"severity": "important",
"file": "apps/server/src/orchestration-v2/AgentOutputGate.ts",
"line": 43,
"summary": "ask_agent and silent_ack are now registered in T3_MCP_TOOLS (packages/shared/src/t3McpToolPresentation.ts), so isExplicitChannelToolName resolves Antigravity (mcp_t3-code_*), Codex/Cursor (t3-code.*), OpenCode (t3-code-<thread>_*), and Claude (mcp__t3-code__*) prefixes cleanly.",
"outcome": "fixed",
"rechecked_head": "ed6b822d3c3afdd7b3819684be9f4ba22f69400f"
},
{
"id": "F2",
"severity": "important",
"file": "apps/server/src/orchestration-v2/AgentOutputGate.ts",
"line": 150,
"summary": "evaluateAgentOutputGate now requires compactDynamicToolOutput(item.output)?.isError !== true, preventing error-returning failureMode: \"return\" channel tools from bypassing the output gate.",
"outcome": "fixed",
"rechecked_head": "ed6b822d3c3afdd7b3819684be9f4ba22f69400f"
},
{
"id": "F3",
"severity": "important",
"file": "apps/server/src/orchestration-v2/AgentOutputGateReactor.ts",
"line": 99,
"summary": "AgentOutputGateReactor now checks shell.activeRunId === null && (shell.latestRunId === null || shell.latestRunId === signal.runId) to fail open when superseded, and dispatches bounces with notification.source: { kind: \"monitor\" } so Orchestrator.ts:8994 never classifies them as delegationReminder or promotes them to steer_active into a racing turn. Verified no unintended side effects in Orchestrator.ts or UI unread/attention.",
"outcome": "fixed",
"rechecked_head": "ed6b822d3c3afdd7b3819684be9f4ba22f69400f"
},
{
"id": "F4",
"severity": "nit",
"file": "apps/server/src/orchestration-v2/AgentOutputGate.ts",
"line": 169,
"summary": "evaluateAgentOutputGate now checks thread.settledOverride === \"settled\" and fails open to agent_fold without dispatching a bounce or unsettling the thread.",
"outcome": "fixed",
"rechecked_head": "ed6b822d3c3afdd7b3819684be9f4ba22f69400f"
}
],
"findings": []
}Focused Re-Check Summary (
|
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.
Deploy: fleet
Problem
CLO-1248 Part 3 (built on Part 1
66f5c7d39865and Part 251045b024c3d). On asyncorigin: "agent"wakes (e.g.,t3_thread_send, watch/event wakes, scheduled wakes), a model can finish with plain assistant text without explicitly routing it (send_to_user,t3_thread_send,ask_agent, orsilent_ack), leaving the intent ambiguous between a founder-facing reply and an internal fold.Fix
silent_ack):SILENT_ACK_TOOL_NAME("silent_ack") inpackages/shared/src/toolOutput.tsand registerSilentAckTool(Tool.Readonly = true,Tool.Destructive = false,Tool.Idempotent = true, hidden from outside clients) alongsidesend_to_userinapps/server/src/mcp/toolkits/message/{tools,handlers}.ts.apps/server/src/provider/agentContextBudget.json(mcpToolListJsonBytes: 75656).AgentOutputGate.ts+AgentOutputGateReactor.ts, wired inserver.ts):origin: "agent"wakes on active, non-retired, non-sideChat, non-subagentthreads —origin: "user"turns,ask_agentside chats, and subagent child threads are never gated or bounced.send_to_user,t3_thread_send,t3_thread_send_attachments,ask_agent, orsilent_ack) or emitted no substantive plain assistant text.origin: "agent"wake, dispatches at most 1 bounce (command: server:output-gate-bounce:<runId>,message: message:output-gate-bounce:<runId>) prompting the model to route explicitly or callsilent_ack.timelineVisibility: "agent_fold"on unstamped assistant items without looping >1 bounce or bumping founder unread/attention.#225nits):timelineVisibilitytoOrchestrationV2ConversationMessageinpackages/contracts/src/orchestrationV2.ts.isUnseenCandidateinpackages/client-runtime/src/seenMarker.tswithmessage.createdBy !== "user"so a human founder's own message is never treated as unseen even if stampeduser_timeline.Verification
effect-tsgo tsrs --noEmit: 0 errors acrosspackages/contracts,packages/shared,packages/client-runtime, andapps/server.packages/client-runtimeseenMarker.test.ts: 13/13 passed (including human-useruser_timelineguard).apps/serverAgentOutputGate.test.ts: 7/7 passed (policy matrix + reactor 1-bounce + fail-openagent_foldstamping).apps/serverAgentContextBudget.test.ts: 2/2 passed.vp fmton all touched files: clean.Model: gemini-4-neon
Task: feat