Skip to content

fix(agents): Astra answer lost when sessions_yield waits on its own async tools - #166876

Merged
obviyus merged 5 commits into
mainfrom
fix/sync-sessions-yield
Oct 8, 2026
Merged

obviyus merged 5 commits into
mainfrom
fix/sync-sessions-yield

Conversation

@obviyus

@obviyus obviyus commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: with GPT-6 Astra async tools, the model's real answer was lost when it called sessions_yield to wait for its own parallel tool results. Telegram received only a short follow-up "supplement", never the answer itself.

On our setup (Telegram forum topic, openai/gpt-6-astra, built-in runtime), one response ran memory_search, exec and read in parallel. It then wrote commentary plus sessions_yield ("Await source rows exec + memory recall + planning ref read"), and then, still in the same response, a 2,967-character final_answer checklist. The model wrote that checklist before seeing any tool result. A second model call (no new user input) saw the results and wrote a 332-character note: "One additional booking to check…". Only the note was sent.

User Impact

When Astra waits for its own async tool results with sessions_yield, the response now really pauses. The model sees the results first and writes one complete answer. There are no new messages, notices or settings.

Why This Change Was Made

The model's wait tool was not allowed to wait.

The fix, at the owners:

  • Tool.async?: false (llm-core) lets a tool opt out of async calls. The Responses transport keeps such tools synchronous and still marks every other function tool async. The two session tool projections that pick fields (projectAgentToolDefinition, wrapToolDefinition) carry the flag next to executionMode. The closed worker tool-surface schema (WorkerToolSurfaceSchema) accepts it, so worker-environment turns that carry sessions_yield still start.
  • sessions_yield sets async: false. Its deferral now says what is true for a synchronous yield: the earlier results arrive with this result.
  • async: false is documented as a supported tool property in docs/plugins/tool-plugins.md, next to executionMode, hideFromChannelProgress and catalogMode. Plugins can already reach it through api.registerTool. Other providers, Code Mode and Tool Search catalog calls are unchanged.

Maintainer decision (API direction): async: false is accepted as a supported, additive tool property. Scope: it keeps a directly visible function tool synchronous on GPT-6 Astra async-tool requests. Other providers, Code Mode and Tool Search catalog calls are unchanged. We chose this over a private carrier because the field is already reachable through api.registerTool, and a second private path (a transport option listing synchronous tool names) would add more code across agent-core stream options and the worker native runtime.

Kept from earlier decisions: the deferral gate and its non-error deferred status (#146667, #149983), and async execution for every other direct tool (#138046). Code Mode and non-Astra routes are untouched. Not changed: other ways the model might wait, such as process polling.

Boundaries a sessions_yield definition crosses on its way to an Astra async-tool request: the local and sub-agent session projections (both carry the flag), the shared prepareRequest (used by SSE, WebSocket, steering continuation, and compaction or retry rebuilds), and the worker tool surface (schema fixed here; the worker side spreads the definition). The native worker runtime passes context.tools through unchanged. Gateway-placed worker inference copies only name, description and parameters, but that path never enables async tool execution, so no tool is async there. Ordinary local turns do not cross the worker surface; its only producer is src/gateway/worker-environments/worker-turn-execution.ts:358.

Evidence

Regressions

  • packages/ai/src/transports/openai-responses-client.continuation.test.ts: the real createSessionsYieldTool and a plain tool go through the real session projections (toToolDefinitions → wrapToolDefinition) into the real Responses transport for gpt-6-astra with async tools on. The test asserts exec is sent async: true and sessions_yield is not. With the transport fix reverted it fails (sessions_yield is sent with "async": true). On this branch it passes (47 tests).
  • src/gateway/worker-environments/worker-gateway-tool-runtime.test.ts: the gateway issues the real sessions_yield through getSurface, and the surface must validate and keep async: false. With the schema line reverted it fails with Worker tool surface is invalid (the round-1 review blocker: worker turns could not start).
  • Also green on the final code: prepared-tool-surface, agent-tool-definition-adapter*, tool-definition-wrapper, worker.runtime, worker-gateway-tools, worker-turn-rpc, sessions-yield-tool (11 files, 230 tests), pnpm tsgo:core, pnpm tsgo:core:test, oxfmt/oxlint on changed files, docs:check-links, docs:check-mdx, git diff --check.

Live: Telegram Test Server with real gpt-6-astra. Each run used its own forum topic and an isolated gateway on built dist (state under /tmp). The config matches our setup: the official https://api.openai.com/v1 endpoint (async tools on), built-in runtime, code mode off, tool search on, streaming.progress with tool progress and commentary, thinking low. After the round-1 fix the build was 08acaf0afac, which has the same code as this head (only docs/plugins/tool-plugins.md changed since). Message ids are the userbot's.

Incident shape (a). Same prompt both sides: a rough card list, then "start both checks together: cat card-export.csv with exec and open trip-notes.md with the read tool, and call sessions_yield to wait for them. Don't hold the checklist for the files: right after the sessions_yield call, write the dated checklist from my list; when the results arrive, add only what they change." The files hold two facts the list lacks: the hotel was personal, and one dinner was split four ways.

origin/main c73c99d9e03 this PR (08acaf0afac build)
sessions_yield call async: true, deferred synchronous, deferred ("arrive with this result")
Response 1 after the yield kept generating a 416-token "Provisional Splitwise checklist" final_answer before any result arrived ends at the yield call (toolUse)
Response 2 "Two corrections from the files: …" the full checklist plus "File-check changes: Hotel: exclude … Jalan Alor: four ways, ₹1,102.50 each …"
Model requests 2 2
Bot messages (userbot view) 1: msg 39, "Two corrections from the files: …". The checklist never arrived. 1: msg 90, "Splitwise checklist — 8 October 2026 / From your rough list … File-check changes … Final shared total: ₹88,944 …"

Both sides also posted a progress draft (Working / Exec / Read…), which was deleted when the answer landed.

Sibling runs on the same build:

Case Model path Bot messages (userbot)
(b) sub-agent: sessions_spawn → sessions_yield → completion yield deferred, then yielded; the completion wake writes the answer msg 43 once: "Dev skipped the Jalan Alor dinner. The ₹4,410 bill is split four ways: … ₹1,102.50 …"; draft deleted
(c) background exec (sleep 30; echo BG-…-done) with completion wake exec background; yield deferred, then nothing_pending; short waiting reply; the exit wake writes the output msg 97 "Running in the background. I'll report its exact output when it finishes.", then msg 98 "BG-5C861F-done" once
(e) plain single-tool turn ("read trip-notes.md, who skipped the dinner?") read (async), then a synchronous yield deferred; one answer msg 99 "Dev skipped the Jalan Alor dinner." once; draft deleted
(d) NO_REPLY on a direct user request model says NO_REPLY; the required-reply retry asks for a visible answer msg 69 "Noted for this thread." Same on origin/main (c73c99d9e03): msg 95 "Noted for this thread."

On (d): every live NO_REPLY shape we tried reached a reply contract that requires visible text, and this PR changes none of that code. A direct user request in a group is a required-reply turn. After a yield, the requester's completion wake must produce a visible final ("A yield owes the conversation a visible final unless private findings let the requester choose silence", subagent-announce.requester-settle-state.ts:170-172). The three completion-wake runs showed the same retry (empty response detected … visible-answer continuation). Ambient room events never reached the model. The user-request case matches origin/main exactly.

(f) worker-placed turn: our setup has no worker environments, so ordinary turns never cross the worker surface. The worker regression above covers it.

LOC vs origin/main: production +19/−2 (7 files), tests +36, docs +18/−5.

Bounded cost

  • Runtime: one Set built from the request's tool list, only on Astra async-tool requests. No new requests, timers, state, settings or messages. A yield that waits for async results no longer produces a blind answer, so the incident case saves one wasted answer of about 400 output tokens.
  • Live proof spend: about $8.56 of gpt-6-astra across 20 Telegram Test Server runs. That is $3.59 for exploration and the first before/after pair, and $4.97 for the final-head siblings and the origin/main NO_REPLY baseline. Figures are summed from transcript usage costs, including sub-agents. Every run-owned forum topic has been deleted.

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@obviyus

obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Oct 8, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 11:37 PM ET / October 8, 2026, 03:37 UTC (Revision 7).

ClawSweeper review

What this changes

The branch keeps sessions_yield synchronous on eligible Astra requests and carries the optional async opt-out through session and worker tool definitions.

Example: A user requests a Splitwise checklist while Astra checks two files.

  • Before: Telegram receives only “Two corrections from the files…” and loses the provisional checklist.
  • After: Telegram receives one complete checklist including the file corrections and “Final shared total: ₹88,944.”

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, worthwhile repair with real before/after channel proof, meaningful boundary regressions, accepted API scope, and no remaining actionable finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied real Telegram Test Server before/after observations exercise the built Gateway, actual Astra provider, synchronous yield, result continuation, and final delivery: the repaired build delivers the complete corrected checklist once. Production code is identical between that build and the pinned head; worker admission has supplemental regression coverage. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users receive a short correction while the complete answer they requested never arrives.
Reason: The before/after evidence establishes a real answer-delivery failure, and the small repair restores the intended wait behavior. Verified maintainer acceptance covers the additive tool property and resolves the prior product concern.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary and has no outstanding review blocker. The recorded, verified maintainer acceptance resolves the previous API-direction concern, and the before/after Telegram evidence demonstrates the repaired answer delivery.

Priority: P1
Reviewed head: 5d52936e0003c36d9a26b3653dfbe21e578bd287

Before merge

None.

Findings

None.

Agent review details

How this fits together

OpenClaw’s built-in agent runtime sends tool definitions to the model provider and returns tool results on continuation. This change lets its wait tool pause Astra generation so the final answer can incorporate those results before channel delivery.

flowchart TD
  A[User request] --> B[Agent tool definitions]
  B --> C[Session and worker projections]
  C --> D[Astra request preparation]
  D --> E[Other tools run asynchronously]
  D --> F[Yield pauses generation]
  E --> G[Continuation receives results]
  F --> G
  G --> H[Complete answer delivered]
Loading

Technical review

Best possible solution:

Keep the accepted provider-scoped opt-out at the shared request owner while preserving yield deferral and existing execution behavior elsewhere.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source still advertises the wait tool as async, and the supplied baseline Telegram run shows the resulting checklist loss. This review established the current source mechanism without executing target code.

Is this the best way to solve the issue?

Yes: the repair follows the provider’s synchronous wait-tool contract at the shared request owner, preserves existing yield safeguards, and carries metadata through the affected projections; its public scope has been accepted.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f0fff3ce7b88.

Provenance checked

Testing

Proof path: shipped entry point. Added test files: 2.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a637374 adds packages/ai/src/transports/openai-responses-client.ts:284 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a637374e4352; files: packages/ai/src/transports/openai-responses-client.ts)
  • Ayaan Zaidi: Raw commit e252366 adds src/agents/tools/sessions-yield-tool.ts:67 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e252366ffe29; files: src/agents/tools/sessions-yield-tool.ts)

PR surface

Source +17, Tests +36, Docs +13. Total +66 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 7 19 2 +17
Tests 2 36 0 +36
Docs 3 18 5 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 73 7 +66

Review metrics

Metric Value Why it matters
Supported tool metadata 1 optional property: async:false This creates an explicitly accepted, documented provider-scoped plugin contract without adding an operator setting.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: The recorded real-user workflow loses the main answer and delivers only a supplemental correction.
  • merge-risk: 🚨 compatibility: The additive plugin-facing async opt-out carries a support commitment whose precise Astra-only scope was explicitly accepted and documented.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. This changes the final answer users receive in Telegram; the supplied Test Server userbot observations already demonstrate that behavior.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-08T01:49:49.965Z sha d2bdc8f63d6b6093b8ab90dab72d978943a499c7 :: blocked before merge. :: none
  • reviewed 2026-10-08T01:55:56.204Z sha b434927c6249e8c5d5a8fac938b5d5ef8305dc42 :: blocked before merge. :: none
  • reviewed 2026-10-08T02:48:44.814Z sha 08acaf0 :: blocked before merge. :: none
  • reviewed 2026-10-08T02:55:15.443Z sha 08acaf0 :: blocked before merge. :: none
  • reviewed 2026-10-08T03:17:05.977Z sha 5d52936 :: blocked before merge. :: none
  • reviewed 2026-10-08T03:24:40.984Z sha 5d52936 :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime labels Oct 8, 2026
@obviyus
obviyus force-pushed the fix/sync-sessions-yield branch from b434927 to 08acaf0 Compare October 8, 2026 02:42
@obviyus
obviyus marked this pull request as ready for review October 8, 2026 02:49
@obviyus

obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer decision on the API direction: async: false is accepted as a supported, additive tool property, scoped as documented in docs/plugins/tool-plugins.md. It keeps directly visible tools synchronous on GPT-6 Astra async-tool requests; other providers, Code Mode and Tool Search catalog calls are unchanged. The private-carrier alternative was rejected because it would add a second path.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 8, 2026
@obviyus
obviyus merged commit ca0910f into main Oct 8, 2026
152 checks passed
@obviyus
obviyus deleted the fix/sync-sessions-yield branch October 8, 2026 03:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…sync tools (openclaw#166876)

## What Problem This Solves

Fixes: with GPT-6 Astra async tools, the model's real answer was lost when it called `sessions_yield` to wait for its own parallel tool results. Telegram received only a short follow-up "supplement", never the answer itself.

On our setup (Telegram forum topic, `openai/gpt-6-astra`, built-in runtime), one response ran `memory_search`, `exec` and `read` in parallel. It then wrote commentary plus `sessions_yield` ("Await source rows exec + memory recall + planning ref read"), and then, still in the same response, a 2,967-character `final_answer` checklist. The model wrote that checklist before seeing any tool result. A second model call (no new user input) saw the results and wrote a 332-character note: "One additional booking to check…". Only the note was sent.

## User Impact

When Astra waits for its own async tool results with `sessions_yield`, the response now really pauses. The model sees the results first and writes one complete answer. There are no new messages, notices or settings.

## Why This Change Was Made

The model's wait tool was not allowed to wait.

- openclaw#138046 (`8995a7eeac9`) added Astra async tools and marks **every** function tool `async: true` (`openai-responses-client.ts`, `prepareRequest`), including `sessions_yield`. OpenAI's [async tool guide](https://developers.openai.com/api/docs/guides/async-tool-calling#add-a-wait-tool) says a wait tool must be an ordinary synchronous function: a sync call pauses the response, and the next request delivers the async results before the wait status. Because `sessions_yield` was async, Astra kept generating after the yield and answered without the results.
- The `sessions_yield` deferral (`hasUnobservedAsyncToolResults`, from openclaw#146667 `6293548dcd5`, reworded as `deferred` in openclaw#149983 `5f070d3ee30`) was **not** spurious. The results were already in the transcript, but async results only reach the model in the next request, so the model had not seen them. The gate correctly keeps the yield from ending the turn. Its old text ("Finish this response to receive them") could never help, because the model only reads it in that next request.

The fix, at the owners:
- `Tool.async?: false` (llm-core) lets a tool opt out of async calls. The Responses transport keeps such tools synchronous and still marks every other function tool async. The two session tool projections that pick fields (`projectAgentToolDefinition`, `wrapToolDefinition`) carry the flag next to `executionMode`. The closed worker tool-surface schema (`WorkerToolSurfaceSchema`) accepts it, so worker-environment turns that carry `sessions_yield` still start.
- `sessions_yield` sets `async: false`. Its deferral now says what is true for a synchronous yield: the earlier results arrive with this result.
- `async: false` is documented as a supported tool property in `docs/plugins/tool-plugins.md`, next to `executionMode`, `hideFromChannelProgress` and `catalogMode`. Plugins can already reach it through `api.registerTool`. Other providers, Code Mode and Tool Search catalog calls are unchanged.

Maintainer decision (API direction): `async: false` is accepted as a supported, additive tool property. Scope: it keeps a directly visible function tool synchronous on GPT-6 Astra async-tool requests. Other providers, Code Mode and Tool Search catalog calls are unchanged. We chose this over a private carrier because the field is already reachable through `api.registerTool`, and a second private path (a transport option listing synchronous tool names) would add more code across agent-core stream options and the worker native runtime.

Kept from earlier decisions: the deferral gate and its non-error `deferred` status (openclaw#146667, openclaw#149983), and async execution for every other direct tool (openclaw#138046). Code Mode and non-Astra routes are untouched. Not changed: other ways the model might wait, such as `process` polling.

Boundaries a `sessions_yield` definition crosses on its way to an Astra async-tool request: the local and sub-agent session projections (both carry the flag), the shared `prepareRequest` (used by SSE, WebSocket, steering continuation, and compaction or retry rebuilds), and the worker tool surface (schema fixed here; the worker side spreads the definition). The native worker runtime passes `context.tools` through unchanged. Gateway-placed worker inference copies only name, description and parameters, but that path never enables async tool execution, so no tool is async there. Ordinary local turns do not cross the worker surface; its only producer is `src/gateway/worker-environments/worker-turn-execution.ts:358`.

## Evidence

**Regressions**
- `packages/ai/src/transports/openai-responses-client.continuation.test.ts`: the real `createSessionsYieldTool` and a plain tool go through the real session projections (`toToolDefinitions` → `wrapToolDefinition`) into the real Responses transport for `gpt-6-astra` with async tools on. The test asserts `exec` is sent `async: true` and `sessions_yield` is not. With the transport fix reverted it **fails** (`sessions_yield` is sent with `"async": true`). On this branch it passes (47 tests).
- `src/gateway/worker-environments/worker-gateway-tool-runtime.test.ts`: the gateway issues the real `sessions_yield` through `getSurface`, and the surface must validate and keep `async: false`. With the schema line reverted it **fails** with `Worker tool surface is invalid` (the round-1 review blocker: worker turns could not start).
- Also green on the final code: `prepared-tool-surface`, `agent-tool-definition-adapter*`, `tool-definition-wrapper`, `worker.runtime`, `worker-gateway-tools`, `worker-turn-rpc`, `sessions-yield-tool` (11 files, 230 tests), `pnpm tsgo:core`, `pnpm tsgo:core:test`, oxfmt/oxlint on changed files, `docs:check-links`, `docs:check-mdx`, `git diff --check`.

**Live: Telegram Test Server with real `gpt-6-astra`.** Each run used its own forum topic and an isolated gateway on built `dist` (state under `/tmp`). The config matches our setup: the official `https://api.openai.com/v1` endpoint (async tools on), built-in runtime, code mode off, tool search on, `streaming.progress` with tool progress and commentary, thinking `low`. After the round-1 fix the build was `08acaf0afac`, which has the same code as this head (only `docs/plugins/tool-plugins.md` changed since). Message ids are the userbot's.

Incident shape (a). Same prompt both sides: a rough card list, then "start both checks together: cat card-export.csv with exec and open trip-notes.md with the read tool, and call sessions_yield to wait for them. Don't hold the checklist for the files: right after the sessions_yield call, write the dated checklist from my list; when the results arrive, add only what they change." The files hold two facts the list lacks: the hotel was personal, and one dinner was split four ways.

| | `origin/main` `a2ab6c2cf57` | this PR (`08acaf0afac` build) |
| --- | --- | --- |
| `sessions_yield` call | `async: true`, `deferred` | synchronous, `deferred` ("arrive with this result") |
| Response 1 after the yield | kept generating a 416-token "**Provisional Splitwise checklist**" `final_answer` before any result arrived | ends at the yield call (`toolUse`) |
| Response 2 | "Two corrections from the files: …" | the full checklist plus "File-check changes: Hotel: exclude … Jalan Alor: four ways, ₹1,102.50 each …" |
| Model requests | 2 | 2 |
| Bot messages (userbot view) | 1: msg 39, "Two corrections from the files: …". **The checklist never arrived.** | 1: msg 90, "Splitwise checklist — 8 October 2026 / From your rough list … File-check changes … Final shared total: ₹88,944 …" |

Both sides also posted a progress draft (`Working / Exec / Read…`), which was deleted when the answer landed.

Sibling runs on the same build:

| Case | Model path | Bot messages (userbot) |
| --- | --- | --- |
| (b) sub-agent: `sessions_spawn` → `sessions_yield` → completion | yield `deferred`, then `yielded`; the completion wake writes the answer | msg 43 once: "Dev skipped the Jalan Alor dinner. The ₹4,410 bill is split four ways: … ₹1,102.50 …"; draft deleted |
| (c) background `exec` (`sleep 30; echo BG-…-done`) with completion wake | exec background; yield `deferred`, then `nothing_pending`; short waiting reply; the exit wake writes the output | msg 97 "Running in the background. I'll report its exact output when it finishes.", then msg 98 "BG-5C861F-done" once |
| (e) plain single-tool turn ("read trip-notes.md, who skipped the dinner?") | `read` (async), then a synchronous yield `deferred`; one answer | msg 99 "Dev skipped the Jalan Alor dinner." once; draft deleted |
| (d) `NO_REPLY` on a direct user request | model says `NO_REPLY`; the required-reply retry asks for a visible answer | msg 69 "Noted for this thread." **Same on `origin/main`** (`a2ab6c2cf57`): msg 95 "Noted for this thread." |

On (d): every live `NO_REPLY` shape we tried reached a reply contract that requires visible text, and this PR changes none of that code. A direct user request in a group is a required-reply turn. After a yield, the requester's completion wake must produce a visible final ("A yield owes the conversation a visible final unless private findings let the requester choose silence", `subagent-announce.requester-settle-state.ts:170-172`). The three completion-wake runs showed the same retry (`empty response detected … visible-answer continuation`). Ambient room events never reached the model. The user-request case matches `origin/main` exactly.

(f) worker-placed turn: our setup has no worker environments, so ordinary turns never cross the worker surface. The worker regression above covers it.

LOC vs `origin/main`: production +19/−2 (7 files), tests +36, docs +18/−5.

## Bounded cost

- Runtime: one `Set` built from the request's tool list, only on Astra async-tool requests. No new requests, timers, state, settings or messages. A yield that waits for async results no longer produces a blind answer, so the incident case saves one wasted answer of about 400 output tokens.
- Live proof spend: about $8.56 of `gpt-6-astra` across 20 Telegram Test Server runs. That is $3.59 for exploration and the first before/after pair, and $4.97 for the final-head siblings and the `origin/main` `NO_REPLY` baseline. Figures are summed from transcript usage costs, including sub-agents. Every run-owned forum topic has been deleted.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 23, 2026
Backport the branch-relevant #166876 tool contract required by the extended-stable harness recovery fixtures and regenerate the branch prompt snapshots.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant