Skip to content

feat(agents): end runs after confirmed final source replies - #170653

Merged
steipete merged 10 commits into
mainfrom
feat/structured-turn-finish
Oct 13, 2026
Merged

steipete merged 10 commits into
mainfrom
feat/structured-turn-finish

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #170147 (current-source completion subcase only).

What Problem This Solves

A delivered final source reply could trigger another model request and an extra confirmation, even though the user had already received the complete response.

User Impact

In embedded and Codex runs, a confirmed final send, reply, thread reply, poll, or added reaction to the current source ends the run in automatic and message-tool delivery modes. Models may choose a final reaction as their complete reply. Progress (final:false), removals, no-op or failed reactions, dry runs, partial deliveries, and actions on other messages do not trigger this terminal action. Existing settled-turn handling of progress followed by empty output is unchanged.

Optional no-action turns retain their existing NO_REPLY guidance. Direct messages, mentions, commands, and accepted groups by default retain their visible-reply requirement. This does not change required/optional admission or the policy in #152786.

Why This Change Was Made

The message delivery owner already knows whether an action reached the current source. Embedded and Codex-backed runs now consume that fact to finish after sibling tools settle and suppress later source text, errors, and mirrored assistant codas. Tool-authored replies awaiting delivery retain their separate whole-batch admission contract. Delivery and finality are captured before presentation hooks, so a hook that redacts or throws cannot erase a committed reply; error diagnostics remain. Only the obsolete after-action token instructions are removed. Shared harness guidance describes the completed-reply contract without promising host termination in unrelated harnesses; the host termination paths implemented and proven here are embedded and Codex.

NO_REPLY and HEARTBEAT_OK parsing, stripping, and replay compatibility are unchanged. Production models and user-authored prompts, skills, and AGENTS files still emit these tokens. Any future removal must start with telemetry/counting and an explicit migration decision.

Codex's native tool handler marks tool calls as needing follow-up (stream_events_utils.rs); its loop combines that with pending input (turn.rs) before stop handling (turn.rs). I inspected these exact sibling-source files. This uses OpenClaw's existing host terminal-release mechanism; it does not change the Codex protocol.

Merge refresh (October 13)

Merged origin/main at ed4e2f875004ec8f9d933075dae402e1c11d093c into this branch with a normal two-parent merge, c3451d7f2a6ae513369b18edc05218ee2c35c7bc. The three conflicts were generated snapshots: telegram-direct-codex-message-tool.md, discord-group-codex-message-tool.md.diff, and telegram-heartbeat-codex-tool.md.diff under test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/. Canonical snapshot regeneration resolved them, preserving main's newer cron tool description and this PR's final-action guidance. Main's newer source-completion retry handling and test-owner changes merged automatically. No manual production-code resolution was needed; this PR's production files are unchanged from the previously reviewed head, so its clean code autoreview is retained. The follow-up silence-marker branch was not changed.

The generated text change relative to the previous head is:

- Idempotent declaration key (add only).
+ Key to avoid duplicate declarations (add only).

The remaining generated diff is hashes and derived counts. Text-only token estimates are unchanged; estimates including tools change from 24,795 to 24,797 for the DM, 25,274 to 25,276 for the group, and 25,252 to 25,255 for the heartbeat. Snapshot generation passed in 62.74s.

Merged-head validation: core source-delivery, retry persistence, terminal resolution, settled-turn finalization, terminal-hook and real-Agent suites pass 213/213 across 11 files (822.01s wrapper wall). Codex source delivery, projection, lifecycle and turn parameters pass 70/70 (540.84s); Copilot selected guidance/SDK cases pass 5/5, with 84 unrelated cases intentionally skipped (226.92s). All seven core/extension production and test type graphs pass (341.97s). Formatting passes for all 47 selected files; diff check passes. Line-cap (11.28s), max-lines (95.48s), assertion safety (208.94s), timeout-race, mock-export, config-doc and plugin-inventory ratchets pass. Scoped lint passes for 24 core files (369.75s) and 19 extension files (605.48s, including SDK declaration generation). All wrappers exited successfully; no test failure, code edit, or baseline exception was needed.

The live model measurements below remain explicitly pinned to their original measured runtime; they were not rerun for this generated-only conflict resolution. The later question-refresh failure and its test-fixture repair are described under CI follow-up. The merge was confirmed mergeable at publication; the PR remains open and unlanded.

Evidence

The original terminal hook fails the real-Agent regression: a confirmed final source action makes two model requests instead of one; the final:false progress control passes. The repaired loop and source-delivery boundaries pass. Fresh review also found a throwing post-tool hook could erase committed delivery; a real-Agent regression reproduced the extra request before the fix and now passes with result redaction, argument mutation, and the error diagnostic retained.

Focused evidence Result Recorded duration
Core delivery, terminal resolution, stream/payload suppression, real-Agent loop (12 files) 349 passed Final hook/loop/suppression rerun 232.31s; other passing shards reused
Codex delivery/projector plus lifecycle (4 files) 65 passed Source/projector project 408.10s; lifecycle wrapper 212.87s; corrected JSON fixture rerun 194.51s
Messaging/groups and settled-turn finalization (3 files) 14 passed 207.28s + 156.80s
Heartbeat/event, WebChat completion, heartbeat response tool, cron policy and repair (6 files) 162 passed 625.91s
Existing empty-turn recovery, optional-empty results, and settled source progress (2 files) 61 passed 362.93s

New loop assertions execute in milliseconds; most elapsed time is cold compiled-worker preparation and imports. Completed passing shards are reused where inputs stayed unchanged; canceled sibling runs and source-restoration-invalidated runs are excluded. Core and extension production/test typechecks, scoped lint, formatting, max-lines, line-cap, assertion safety, timeout-race, mock-export, config-doc and plugin-inventory checks pass. The measured-head real-Gateway runtime build (OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build qaRuntime) passed in 408.25s at 46a141ddf45b571123d0146cc54a7922b9d79001. Release-wide declaration generation was stopped after 54 minutes; the targeted SDK declaration gate used by extension lint passed. Pre-merge head 078d15c7eb9c00d5b0b5463d71ce499c39663490 passes full-branch isolated Codex autoreview through P2, with no findings, after fixing the confirmed hook-exception finding. Final scoped extension lint passes (223.18s); assertion safety (41.05s), max-lines (43.34s), and line-cap (9.19s) pass again before push.

CI follow-up

Question-refresh CI repair

Repair commit: 13d8115b40ebf4a08829488d900a14ce1eee3f32. GitHub confirms this head is mergeable; CI run 38372900973 has started (preflight in progress). CI completion is not claimed.

The previous head's CI run 38368011842 failed the gateway-backed case in extensions/codex/src/app-server/run-attempt.question-refresh.test.ts while queueing input. The failure occurs before reload_runtime, and this fixture makes no final source send or reaction. Its request counter also prevents terminal release while native user input remains outstanding, so changing that production policy would not repair this failure.

Five unchanged-head repetitions reproduced a related earlier failure in the same case: four runs passed; the fifth failed before the question prompt was delivered. Running the same five-file CI scope also failed that case (23 passed, one failed). The fixture froze Date and timeout callbacks while execution deadlines use performance.now() captured before asynchronous preparation. Cold preparation could therefore exhaust the real five-second monotonic budget, and subsequent fake-clock polling fired an already-expired deadline.

The fixture now freezes performance with its other clocks. It also retains the zero-advance prompt polling introduced upstream in #170709. CI's synthetic merge already had that polling change; freezing the missing clock is the additional repair. No production code, timeout budget, behavior assertion, prompt, or snapshot changes. The existing gateway/secret/staged-secret scenarios remain the regression coverage.

Validation: the five-file CI scope passes 24/24 (390.41s). Codex source-reply, projector, lifecycle and turn-parameter checks pass 70/70 (299.90s); Copilot passes all five selected cases (202.92s). Extension-test types pass (12.63s), scoped lint passes (172.73s), and formatting passes (0.55s). Line-cap (22.26s), max-lines (93.22s), assertion safety (121.34s), timeout-race (20.85s), and mock-export (43.36s) ratchets pass. Isolated review of the repair is clean through P2. Core source delivery, terminal resolution, settled finalization, retry persistence and terminal-hook checks pass 213/213 across 11 files (478.78s). Five repaired fresh-process repetitions pass all three cases each: 265.80s, 87.69s, 56.69s, 61.11s and 86.08s. All wrappers joined successfully and verified their input generations. Repair size: production +0/-0; tests +7/-3 relative to the prior head. Prompts and generated snapshots are unchanged. The existing live-model measurements remain pinned to their original runtime head.

The first ready-PR run exposed stale partial-delivery and media-payload expectations, a missed Twitch test caller of the renamed hook, and the existing 1,000-byte policy-fragment budget. The test callers/expectations are migrated, and redundant guidance is shortened to retain that budget. The partial-delivery owner passes 98/98 (59.35s), Twitch 12/12 (120.30s), turn parameters 11/11 (82.09s), and the two corrected media cases 2/2 (354.63s, dominated by module import/transform). The selected test typechecks pass (667.65s including artifact waits). The final partial-delivery assertion uses the canonical state without growing the oversized test file; its two cases pass (205.16s). The exact CI base passes the original partial/Twitch assertions, confirming branch attribution. A later changed-extension shard found two Copilot assertions matching redundant wording removed for the budget; both now assert the completed-reply contract. Shared guidance uses that contract without promising native termination to unrelated harnesses. The final Codex turn-parameter suite passes 11/11 (177.00s wrapper wall). The two Copilot files pass all five selected cases (179.27s); unchanged assertions pass all five on exact CI base 0348a2526c561d8ccce61bfd23931024a6b8f13e (224.21s), establishing attribution.

On this Mac, the real-Gateway Codex cache test gets past the repaired size check but fails because the native request omits instructions; the untouched exact CI base fails at the same assertion. Branch wall time was 280.33s. Separately, CI's agents-sessions type failure at main-session-restart-recovery-admission.test.ts:705 reproduces identically on exact base c2074b2b7c9bb4526a01f7ec2845b8aa712ff535 (20.16s). Neither is claimed passing locally.

Pre-merge CI and review disposition

Pre-merge head 078d15c7eb9c00d5b0b5463d71ce499c39663490 CI run 38362337380 completed with the changed-code suites passing, including the repaired Copilot shard. openclaw/ci-gate is red because checks-node-compact-small-4 fails two Teams reaction-read integration assertions. This is inherited from exact CI base c146b99c60acdad642f90289d8655745f19e8f3e: its 4526ce20ef05d (#151128) decoder reads Graph's nested user.user, while test/msteams-read-authority.integration.test.ts still supplies the flat fixture. Both failures reproduce unchanged on that base in 126.32s (users: [] versus the expected user); the same two cases pass on this branch in 79.58s. The CI classifier calls this new because its older scheduled-main job passed and it did not compare selected scope; the exact-base reproduction establishes inheritance. No unrelated Teams code or fixtures are changed here.

ClawSweeper reviewed pre-merge head 078d15c7eb9c00d5b0b5463d71ce499c39663490: both prior Copilot findings are resolved, and there are no actionable code findings. Its sole before-merge item was classifying the Teams failure, now reproduced above. The full-branch isolated review is also clean through P2.

Proof limit: native Codex and Telegram Test Server E2E were not run; the supplied live proof is the isolated macOS Gateway/Ollama QA channel comparison, with Codex lifecycle/projector coverage in process.

Why optional silence guidance stays

A separate 1,800-trial probe on this Mac tested compact source-derived prompts through direct provider APIs and native Ollama, including synthetic successful tool results. Clean no-text turns were 0/60 for Sonnet, 20/60 for Haiku, 28/30 for Opus (two U+200B responses), 60/60 for each tested OpenAI interface/model, and 0/60 for each Qwen model. Literal NO_REPLY was substantially more reliable: Sonnet 60/60, Opus 30/30, Haiku 58/60, and Qwen 8B 47/60. Qwen 4B often exhausted its output budget; these results do not establish its eventual completion behavior. This is direct API evidence, separate from the full Gateway comparison below.

The probe also observed duplicate confirmations after successful source actions. Host termination avoids asking for that continuation at all. It does not rely on every model reliably producing an empty assistant message.

Prompt changes

Only obsolete current-source after-action silence advice is removed; optional no-action token guidance remains. Boot notifications and native Feishu drive-comment actions retain their advice because they can send outside the current-source terminal path. Representative changes:

-- After visible `message(send)`, final ONLY NO_REPLY.
+- A confirmed final message or added final reaction to the current source completes the reply; never repeat it in text.
-For react, set true only when the user explicitly requested the reaction to the current source message as the complete response.
+For react, set true when adding a reaction to the current source message is your complete response.
-If no text reply is needed, including after a reaction or other action, reply with exactly "NO_REPLY" ...
+If no text reply is needed, reply with exactly "NO_REPLY" ...

Snapshots were regenerated with pnpm prompt:snapshots:gen; generated outputs were not hand-edited. Generator estimates (text / including dynamic tools):

Scenario Before After Delta
Telegram DM 6,895 / 24,801 6,893 / 24,795 -2 / -6
Discord group 7,225 / 25,280 7,222 / 25,274 -3 / -6
Heartbeat 6,980 / 25,259 6,977 / 25,252 -3 / -7

These are rough ceil(chars/4) estimates, not provider billing counts.

Native local-model comparison

Completed 160 fresh-session turns on macOS: four scenarios × two models × two revisions × N=10. Baseline: 799b7a347c502912efb704b1722e117bc0a644ed. Branch: 46a141ddf45b571123d0146cc54a7922b9d79001. The previous branch measurements at 20ae1fcc5502b884e80f65a8ad3e2de58439da16 are archived and superseded by this complete rerun after the prompt-budget repair.

These are real native Ollama calls through an isolated OpenClaw Gateway, the embedded harness, automatic source delivery, and the QA channel. Input/transport fixtures are synthetic. This exercises real model execution, message tools, delivery, and settled-turn finalization at the Gateway/channel boundary; it is not external messaging-service delivery proof. Optional no-action and heartbeat scenarios were excluded after the scope decision to retain their existing guidance; the separate provider silence probe covers that decision.

The baseline made 28 extra native calls across 28 confirmed-final turns. The branch made 0 across 29. Baseline produced 22 retained source text replies after first final receipt, or 45 visible text IDs including previews. The branch counts were 1 retained source text and 1 visible text ID including previews. The branch exception is a same-native-response sibling-tool duplicate: one 4B response contained two identical final sends, and both reached the transport before the first persisted tool result. This is included in all duplicate/post-receipt counts, not a later model continuation. Actual tool-start/hook-confirmation timestamps are unavailable; transport receipts do not establish that boundary.

All-run duplicates changed 25 → 5. Four remaining branch duplicates came from capped 4B outputs with no confirmed final tool action; the fifth is the sibling-tool send above. Required numeric controls produced exactly one correct text reply and no tool calls in 40/40 baseline turns and 40/40 branch turns. Across all 160 runs: leaked-token turn count 1, 0 canned host fallbacks, 0 missing required visible replies, 0 error-marked host replies, and 0 harness errors. The branch leaked-token turn exposed NO_REPLY in 54 transient preview edits during 4B group-mention deliberation before its clean 13 final. It was a no-tool, pre-final output path with the intentionally retained optional group guidance; no parser, prompt, or parameter was retuned. Successful final reactions: 4B 0/10 → 2/10; 8B 10/10 → 10/10. Successful final source sends: 4B 8/10 → 7/10; 8B 10/10 → 10/10. Semantic action failures stay in the data; prose mentioning the requested marker does not count as a source send.

Settings were frozen: native Ollama 0.40.3; qwen3:4b and qwen3:8b, Q4_K_M; temperature 0.2; 32,768 context; 1,024 output limit; think:false plus /no_think on every input. Stock 4B still emitted deliberation and some calls hit the cap (15 baseline, 11 branch; all 4B). No settings or scenario prompts were retuned after seeing results. These small samples establish observed host behavior, not improved model action selection. Wall times are observations on a shared Mac, not a throughput claim.

Counts below are totals per cell. Time and prompt-token columns are means; native prompt tokens sum prompt_eval_count across every request in a turn. Wall time includes admission through settled-turn observation. Leaks include temporary previews. Missing means no required visible action; semantic failures are separate. Canned fallback matches only the two exact host fallback strings.

Model Scenario Version N Visible Leaks Dupes Fallbacks Missing Mean time (s) Mean prompt tokens Model calls
qwen3:4b mention base 10 10 0 0 0 0 4.69 4527 10
qwen3:4b mention branch 10 10 1 0 0 0 4.16 4524 10
qwen3:4b qa-control base 10 10 0 0 0 0 4.84 4247 10
qwen3:4b qa-control branch 10 10 0 0 0 0 4.12 4254 10
qwen3:4b reaction base 10 11 0 1 0 0 33.84 11843 24
qwen3:4b reaction branch 10 11 0 1 0 0 27.57 12741 25
qwen3:4b source-send base 10 19 0 9 0 0 18.27 8377 18
qwen3:4b source-send branch 10 14 0 4 0 0 10.20 4275 10
qwen3:8b mention base 10 10 0 0 0 0 1.88 4529 10
qwen3:8b mention branch 10 10 0 0 0 0 1.15 4534 10
qwen3:8b qa-control base 10 10 0 0 0 0 1.56 4253 10
qwen3:8b qa-control branch 10 10 0 0 0 0 1.14 4269 10
qwen3:8b reaction base 10 15 0 5 0 0 6.25 8844 20
qwen3:8b reaction branch 10 10 0 0 0 0 5.24 4280 10
qwen3:8b source-send base 10 20 0 10 0 0 3.30 8795 20
qwen3:8b source-send branch 10 10 0 0 0 0 1.94 4285 10
Model Version N Semantic passes Host errors Harness errors Raw-token calls Completion tokens
qwen3:4b base 40 28 0 0 0 37184
qwen3:4b branch 40 29 0 0 1 34044
qwen3:8b base 40 40 0 0 0 1718
qwen3:8b branch 40 40 0 0 0 1272

Conditional analysis requires an actual native final call matched one-to-one to successful exact-source transport receipts. Sends are final unless explicitly false; reactions require explicit true, addition, and the current source message. Post-receipt text is ordered by QA cursor, including previews and same-response sibling sends. The final duplicate column isolates multiple final effects from the first native response; it is not subtracted from the other columns. — means no confirmed final to assess.

Model Scenario Version N Final intent Confirmed final Extra model calls after final Visible text after first receipt (incl. previews) Same-response final duplicates
qwen3:4b reaction base 10 9 0 — — —
qwen3:4b reaction branch 10 9 2 0 0 0
qwen3:4b source-send base 10 8 8 8 15 0
qwen3:4b source-send branch 10 7 7 0 1 1
qwen3:8b reaction base 10 10 10 10 10 0
qwen3:8b reaction branch 10 10 10 0 0 0
qwen3:8b source-send base 10 10 10 10 20 0
qwen3:8b source-send branch 10 10 10 0 0 0

Reproduction from each pinned, built checkout:

TURN_FINISH_OLLAMA_URL=http://127.0.0.1:55906 \
TMPDIR=/private/tmp/oc-lm-turn-finish/tmp \
node /private/tmp/oc-lm-turn-finish/measurement/run.mjs base-final qwen3:4b,qwen3:8b 10

Use branch-final with TURN_FINISH_EXPECT_HEAD=46a141ddf45b571123d0146cc54a7922b9d79001 for the branch. The harness boots via plain pnpm openclaw --profile … gateway run, validates generated config, and waits for the QA inbound poll acknowledgment after dispatch settles. The daemon, Gateway state/config/profile/ports, and workspaces are isolated; no operator Gateway or shared Ollama listener is changed.

Final follow-up commit 078d15c7eb9c00d5b0b5463d71ce499c39663490 only updates shared non-embedded harness wording, the matching tests, and Codex snapshots; the measured embedded runtime and model-facing inputs are unchanged. Raw evidence, request ownership audit, native usage, exact-source receipts, method, and generated tables are retained under /private/tmp/oc-lm-turn-finish/measurement/. audit.json verifies exact heads, all 160 unique runs, N=10 cells, request ownership, frozen native settings, mention facts, automatic delivery, complete usage, and control behavior. This is macOS-only proof.

Change size

Production: +227/-182 lines (net +45). Tests: +817/-249; generated snapshots: +46/-46; docs: +6/-4. The positive production delta carries canonical delivery completion through the Codex lifecycle and output projector, and suppresses later embedded output across stream/final/error paths. Nearby obsolete branches were removed; further reduction would obscure these ownership boundaries.

Follow-ups and scope

End both agent loops after confirmed final replies or added final reactions
on the current source. Preserve progress continuation and suppress later
source text after completion, including Codex transcript projections.

Replace generated NO_REPLY guidance with empty completion for optional
turns. Keep legacy token parsing and required-reply policy unchanged.

Related: #170147 (current-source completion subcase only)
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: XL labels Oct 13, 2026
@steipete
steipete marked this pull request as ready for review October 13, 2026 06:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T08:21:11.905695Z c3451d7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown
Contributor

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: 20ae1fcc55

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

export function installMessageToolOnlyTerminalHook(
export function installMessageToolTerminalHook(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Update callers of the renamed terminal hook

Renaming this export without updating test/twitch-message-tool-delivery.test.ts leaves that test importing and invoking the removed installMessageToolOnlyTerminalHook symbol, so the Twitch delivery suite fails while loading instead of exercising its cases. Rename that caller too, or retain a compatibility alias.

AGENTS.md reference: AGENTS.md:L50-L53

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 13, 2026
@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR ends embedded and Codex runs after confirmed final source replies and suppresses subsequent source output.

Example: The agent adds 👍 to the current inbound message using final:true.

  • Before: The model can continue and post an unnecessary confirmation.
  • After: The host settles sibling tools and completes the run without requesting another answer.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, coherent repair with resolved prior findings and real Gateway evidence; it intentionally fixes only part of the linked issue.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; its native Ollama comparison exercises the shipped isolated Gateway and embedded message-delivery path, while Codex changes have in-process lifecycle/projector coverage and the supplied image shows the original failure.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Users receive extra confirmations or fallback output after their complete source reply has already been delivered.
Reason: The maintainer-author approves the completion-policy change, and the measured Gateway behavior supports its value; the broader linked issue remains open.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: both prior findings are fixed, and the current-source completion repair remains useful; no new introduced defect was found.

Priority: P2
Reviewed head: 078d15c7eb9c00d5b0b5463d71ce499c39663490

Before merge

  • Complete next step - Classify the Teams reaction-read failure against the CI base and apply the normal inherited-failure disposition if confirmed; no PR-owned repair is established.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied Gateway comparison exercises embedded execution; native Codex and Telegram Test Server behavior are not directly demonstrated.
Agent review details

How this fits together

The message delivery owner records confirmed source delivery; embedded and Codex lifecycle owners consume that fact to finish execution and suppress later reply projections.

flowchart LR
  A[Model tool call] --> B[Message delivery owner]
  B --> C[Confirmed source delivery]
  C --> D[Embedded completion hook]
  C --> E[Codex lifecycle controller]
  D --> F[Completed run]
  E --> F
  C --> G[Suppress later source output]
Loading

Technical review

Best possible solution:

Retain the canonical delivery-driven completion repair while leaving cross-chat silence and token-policy changes with their existing trackers.

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

Current main exposes the continuation path, and the supplied native Gateway comparison reports matching before/after behavior; this review executed no target code.

Is this the best way to solve the issue?

Using the existing delivery owner’s committed fact is appropriate, preserves progress and route exclusions, and avoids relying on models to generate silence after successful completion.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c40f3ca adds src/agents/embedded-agent-message-tool-source-reply.ts:119 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c40f3ca13352; files: src/agents/embedded-agent-message-tool-source-reply.ts)
  • Josh Avant: Raw commit 90a767c adds src/agents/embedded-agent-message-tool-source-reply.ts:152 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 90a767c300d2; files: src/agents/embedded-agent-message-tool-source-reply.ts)
  • Mariano: Raw commit 0ed2e0c adds src/agents/embedded-agent-runner/run/message-tool-terminal.ts:89 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 0ed2e0c7a18d; files: src/agents/embedded-agent-runner/run/message-tool-terminal.ts)

PR surface

Source +45, Tests +564, Docs +2. Total +611 across 50 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 26 228 183 +45
Tests 22 855 291 +564
Docs 2 6 4 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 50 1089 478 +611

Review metrics

Metric Value Why it matters
Production versus tests Production +227/-182; tests +810/-246 The production growth carries committed finality through lifecycle and projection boundaries; tests add real-Agent continuation coverage and distinct delivery, middleware, and sibling-settlement controls.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: Unnecessary continuations and duplicate confirmations affect completed channel conversations without establishing an urgent availability regression.
  • merge-risk: 🚨 compatibility: Completed source sends now terminate automatic-mode runs, and agents may choose final reactions; the maintainer-authored PR explicitly accepts these behavioral changes and retains final:false for progress.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Final source sends and reactions change whether Telegram users receive subsequent text, which Telegram’s Test Server can observe.

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 execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-13T07:14:28.478Z sha 46a141d :: needs changes before merge. :: [P2] Scope terminal-completion guidance to supported harnesses | [P2] Update both Copilot assertions affected by the guidance change

Reviewed October 13, 2026, 3:31 AM ET / 07:31 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Final reviewed head: 078d15c. The last follow-up fixes stale Copilot assertions and keeps shared guidance accurate for harnesses outside the embedded/Codex termination paths. Focused branch/base tests, regenerated snapshots, scoped lint, ratchets, and full-branch isolated review pass. The PR body now includes the final 160-turn native Qwen comparison and its same-response duplicate/pre-final preview limitations.

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 13, 2026

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

Copy link
Copy Markdown
Contributor

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: 078d15c7eb

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

: "No source-conversation reply can be sent from this turn. Final assistant text remains private and returns to the invoking workflow; it is not automatically delivered to the source conversation."
: params.messageToolAvailable
? "You can participate in the conversation throughout your work. Use `message` when you have something worth saying; you don’t need to wait until you’re finished, and sending a message doesn’t end your task. OpenClaw delivers your final response automatically."
? "Use `message` with `final=false` for progress. A completed send to the current source conversation (`final=true`, or omitted) or an added reaction to its current message with `final=true` is your complete reply. Do not repeat delivered content. Otherwise, OpenClaw delivers your final response automatically."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Limit terminal guidance to harnesses that can stop

In automatic mode this shared guidance is also injected by extensions/copilot/src/prompt-guidance.ts, but the Copilot bridge converts a successful tool result to an SDK result without carrying terminate, and attempt-execution.ts still waits for session.sendAndWait() to complete the post-tool model loop. Consequently, when Copilot calls message with final:true or an omitted final, it still generates a subsequent assistant response that automatic delivery can send as a duplicate, despite this newly claiming the tool call is the complete reply. Keep the previous guidance for non-terminating harnesses or implement delivered-final termination and output suppression there too.

AGENTS.md reference: AGENTS.md:L82-L82

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 7a5529f into main Oct 13, 2026
138 checks passed
@steipete
steipete deleted the feat/structured-turn-finish branch October 13, 2026 09:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 13, 2026
## What Problem This Solves

The cancellation case in `src/gateway/server.chat.canonical-publication.test.ts` waited for a follow-up model request that can no longer occur after a final delivered message. Commit 7a5529f (#170653) deliberately ends ordinary turns after a confirmed final source reply. Message sends are final by default.

Set `final: false` only on the cancellation scenario's synthetic message send, so it reaches the pending follow-up request that the test intends to abort. Preserve every cancellation, sanitized publication, attachment download and idempotent replay assertion. Other cases retain default finality.

## Evidence

- Failing main evidence: https://github.com/openclaw/openclaw/actions/runs/38378024699/job/115231445890, `chat.send preserves canonical sanitized message publication through chat.history and artifacts.download`: `final request was not held`.
- Culprit verified against its parent-relative patch: 7a5529f removes the message-tool-only restriction and installs whole-turn completion after a final delivered source reply. Current `resolveMessageToolSourceReplyFinal` treats omitted `final` as true.
- Changed-file oxfmt, oxlint and `git diff --check` pass. One isolated Codex review covers this patch and the independent recovered-output fixture patch; status: scoped-clean at P2, no actionable findings.
- Original failing case passed in PR CI run [38380534855](https://github.com/openclaw/openclaw/actions/runs/38380534855/job/115239951360): 37.186 seconds; Vitest 87.83 seconds. All ordinary PR CI leaves and required aggregate contexts passed on reviewed head `0c0421ce8846d73b9491b409fc9a50214d61eb45`. No local test suite was run.
- Production LOC: 0. Test LOC: +2/-0. No production behavior, SQL/request count, T1, schema, SDK or update-path change. No SQL harness or local broad checks run. No removed production checks or new accepted edge cases.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…#170653)

* feat(agents): finish turns with structured source replies

End both agent loops after confirmed final replies or added final reactions
on the current source. Preserve progress continuation and suppress later
source text after completion, including Codex transcript projections.

Replace generated NO_REPLY guidance with empty completion for optional
turns. Keep legacy token parsing and required-reply policy unchanged.

Related: openclaw#170147 (current-source completion subcase only)

* fix(agents): preserve optional-turn silence guidance

* test(codex): type source reply fixtures as JSON objects

* fix(agents): preserve final delivery when result hooks throw

* test(agents): align delivery checks with structured completion

* test(codex): expect finality on delivered media

* test(agents): keep delivery regression within line budget

* fix(agents): align shared final reply guidance and callers

* test(codex): freeze monotonic time in question refresh

Keep the execution deadline on the fixture clock during cold asynchronous
preparation. Preserve upstream zero-advance polling for prompt delivery.
No production timeout or final-action termination policy changes.

Co-authored-by: sunlit-deng <[email protected]>

---------

Co-authored-by: sunlit-deng <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
)

## What Problem This Solves

The cancellation case in `src/gateway/server.chat.canonical-publication.test.ts` waited for a follow-up model request that can no longer occur after a final delivered message. Commit 12e06d3 (openclaw#170653) deliberately ends ordinary turns after a confirmed final source reply. Message sends are final by default.

Set `final: false` only on the cancellation scenario's synthetic message send, so it reaches the pending follow-up request that the test intends to abort. Preserve every cancellation, sanitized publication, attachment download and idempotent replay assertion. Other cases retain default finality.

## Evidence

- Failing main evidence: https://github.com/openclaw/openclaw/actions/runs/38378024699/job/115231445890, `chat.send preserves canonical sanitized message publication through chat.history and artifacts.download`: `final request was not held`.
- Culprit verified against its parent-relative patch: 12e06d3 removes the message-tool-only restriction and installs whole-turn completion after a final delivered source reply. Current `resolveMessageToolSourceReplyFinal` treats omitted `final` as true.
- Changed-file oxfmt, oxlint and `git diff --check` pass. One isolated Codex review covers this patch and the independent recovered-output fixture patch; status: scoped-clean at P2, no actionable findings.
- Original failing case passed in PR CI run [38380534855](https://github.com/openclaw/openclaw/actions/runs/38380534855/job/115239951360): 37.186 seconds; Vitest 87.83 seconds. All ordinary PR CI leaves and required aggregate contexts passed on reviewed head `0c0421ce8846d73b9491b409fc9a50214d61eb45`. No local test suite was run.
- Production LOC: 0. Test LOC: +2/-0. No production behavior, SQL/request count, T1, schema, SDK or update-path change. No SQL harness or local broad checks run. No removed production checks or new accepted edge cases.
obviyus added a commit that referenced this pull request Oct 18, 2026
…176141)

Related: #170653, #176092

## What Problem This Solves

Fixes: a cron job stops right after it sends a message to its own delivery target, so its next steps never run.

## User Impact

User impact: a cron job can send to its configured chat with the `message` tool and then continue, for example to update a state file or ledger. Before this fix the turn ended about 0.3 s after the send. A job that recorded "reserved" before sending never recorded "sent", and the next run refused to post because it could not prove delivery. Chat replies are unchanged.

## Why This Change Was Made

Cron runs use the job's delivery target as the turn's current source. Since #170653, a confirmed send to that source with `final` omitted counts as the final source reply:
- Codex interrupts the turn (`turn.dynamic_tool_terminal_release`, then `turn/interrupt`).
- The embedded runner returns `terminate: true`.

A cron target is a configured destination, not a conversation the turn answers, so the send should not end the turn.

What changed:
- The cron source-delivery plan now owns this decision: `messageTool.finalByDefault: false`, passed to runs as `messageToolFinalByDefault`.
- One resolver, `resolveMessageToolSourceReplyFinal(args, finalByDefault)`, applies it at every place that decides finality: Codex dynamic tools, the embedded terminal hook and subscriber, and CLI evidence.
- An explicit `final` still wins.
- `resolveMessageToolSourceReplyFinal` is now exported from `plugin-sdk/agent-harness-runtime`, next to its sibling `isDeliveredMessageToolOnlySourceReplyResult`, so Codex uses the same owner. The public export budgets go up by one (callable 2206 to 2207, total 3808 to 3809), each with a recorded reason.
- Chat turns keep the default (omitted `final` ends the turn).
- Delivery facts do not change. A send still counts as reaching the cron target, so `announce` still skips its fallback and no duplicate posts.
- The model's turn guidance (Codex `openclaw_source_delivery` context and embedded runtime instructions) now states the rule when the default is off. Chat guidance text is byte-identical.

This change is compatible with #176093. That PR keys on an explicit `final: false`, and this change does not touch it.

Comparison: hermes-agent never ends a turn on a send. Its cron same-target guard returns a skipped tool result and lets the turn continue (NousResearch/hermes-agent#1357).

### Decision

Cron turns intentionally stop following the "omitted `final` ends the turn" default from #119605/#170653. That default fits a chat, where the send answers the inbound message. A cron target is a configured destination, and the job decides when it is done.
- **Tradeoff accepted:** a cron send with `final` omitted costs one more model call, the call #170653 removed. Losing a job's post-send steps without notice costs more.
- **Users see no duplicates:** `announce` still skips its fallback after a send, and `none` keeps the final text private.
- **Unchanged:** chat turns and an explicit `final`.

## Evidence

**Live failure (Codex runtime, stock main):**
- A daily cron photo job sent its photo (`ok: true`).
- The trajectory then shows `tool.result`, then `turn.dynamic_tool_terminal_release` 4 ms later, then `model.completed` with no assistant text, then `session.ended`.
- The job's next step, marking its ledger entry `sent`, never ran. The next run blocked on the unconfirmed entry.

**End-to-end, QA Lab** (real gateway, cron scheduler, qa-channel, mock-openai; the Codex cell runs the real `codex app-server`). New scenario `cron-send-then-continue` covers delivery modes `none` and `announce`. In each, the model sends to the delivery target without `final`, then writes a marker file, then finishes.

| | embedded | codex |
|---|---|---|
| main `adb12365084` (no fix) | fail: one request, turn ended after send | fail: one request, turn ended after send |
| this PR | pass: send, then `write`, one channel message per mode | pass: send, then `bash`, one channel message per mode |

Each runtime cell's scenario details now include the request trace for each delivery mode (`message -> next tool -> final`, plus what qa-channel received). This run is at the PR head:

```text
codex     none: message -> exec_command -> final; channel=["QA-CRON-SEND-CONTINUE-SENT"] | announce: message -> exec_command -> final; channel=["QA-CRON-SEND-CONTINUE-SENT"]
embedded  none: message -> write -> final;        channel=["QA-CRON-SEND-CONTINUE-SENT"] | announce: message -> write -> final;        channel=["QA-CRON-SEND-CONTINUE-SENT"]
```

On main, both cells stop after the first request: `requests=[{"tool":"message",...}]`, and no further tool call follows.

**Regression scenarios on both runtimes:** 10 message-tool, cron, sub-agent and A2A scenarios, run under `--runtime-pair openclaw,codex`.
- Pass, with no change in the chat paths: `group-visible-reply-tool`, `message-tool-stranded-final-reply`, `group-message-tool-unavailable-fallback`, `cron-send-then-continue`. `runtime-tool-message-tool` skipped.
- Fail: `cron-failed-tool-terminal-finalization` (Codex cell), `a2a-message-tool-mirror-dedupe`, `message-delivery-decision-inspection`, `subagent-forked-context`, `yield-rejection-no-warning` (Codex cell). Each fails in the same runtime cells on unpatched main `adb12365084` on this host, so these failures already exist on main and are not caused by this change.

**Unit:**
- New matrices in the Codex dynamic-tool and embedded terminal-hook suites, plus a cron run assertion. On main, exactly the bug cells fail (7 failed); with this PR all pass.
- 17 affected files, 572 tests, all passing. This includes the existing duplicate-reply protection suites (`message-tool-terminal*.test.ts`, `dynamic-tools.source-reply`, `run-attempt-lifecycle-controller`, `event-projector.source-finish`, `message-tool-execution`) and `agent-tools.prefix-stability`, all unchanged.

**Lint:** `oxlint --type-aware` reports `max-lines` on `run-attempt-dispatch.ts` and three unresolved-type errors in `dynamic-tools.ts`. All four already appear on main with the same local setup.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…penclaw#176141)

Related: openclaw#170653, openclaw#176092

## What Problem This Solves

Fixes: a cron job stops right after it sends a message to its own delivery target, so its next steps never run.

## User Impact

User impact: a cron job can send to its configured chat with the `message` tool and then continue, for example to update a state file or ledger. Before this fix the turn ended about 0.3 s after the send. A job that recorded "reserved" before sending never recorded "sent", and the next run refused to post because it could not prove delivery. Chat replies are unchanged.

## Why This Change Was Made

Cron runs use the job's delivery target as the turn's current source. Since openclaw#170653, a confirmed send to that source with `final` omitted counts as the final source reply:
- Codex interrupts the turn (`turn.dynamic_tool_terminal_release`, then `turn/interrupt`).
- The embedded runner returns `terminate: true`.

A cron target is a configured destination, not a conversation the turn answers, so the send should not end the turn.

What changed:
- The cron source-delivery plan now owns this decision: `messageTool.finalByDefault: false`, passed to runs as `messageToolFinalByDefault`.
- One resolver, `resolveMessageToolSourceReplyFinal(args, finalByDefault)`, applies it at every place that decides finality: Codex dynamic tools, the embedded terminal hook and subscriber, and CLI evidence.
- An explicit `final` still wins.
- `resolveMessageToolSourceReplyFinal` is now exported from `plugin-sdk/agent-harness-runtime`, next to its sibling `isDeliveredMessageToolOnlySourceReplyResult`, so Codex uses the same owner. The public export budgets go up by one (callable 2206 to 2207, total 3808 to 3809), each with a recorded reason.
- Chat turns keep the default (omitted `final` ends the turn).
- Delivery facts do not change. A send still counts as reaching the cron target, so `announce` still skips its fallback and no duplicate posts.
- The model's turn guidance (Codex `openclaw_source_delivery` context and embedded runtime instructions) now states the rule when the default is off. Chat guidance text is byte-identical.

This change is compatible with openclaw#176093. That PR keys on an explicit `final: false`, and this change does not touch it.

Comparison: hermes-agent never ends a turn on a send. Its cron same-target guard returns a skipped tool result and lets the turn continue (NousResearch/hermes-agent#1357).

### Decision

Cron turns intentionally stop following the "omitted `final` ends the turn" default from openclaw#119605/openclaw#170653. That default fits a chat, where the send answers the inbound message. A cron target is a configured destination, and the job decides when it is done.
- **Tradeoff accepted:** a cron send with `final` omitted costs one more model call, the call openclaw#170653 removed. Losing a job's post-send steps without notice costs more.
- **Users see no duplicates:** `announce` still skips its fallback after a send, and `none` keeps the final text private.
- **Unchanged:** chat turns and an explicit `final`.

## Evidence

**Live failure (Codex runtime, stock main):**
- A daily cron photo job sent its photo (`ok: true`).
- The trajectory then shows `tool.result`, then `turn.dynamic_tool_terminal_release` 4 ms later, then `model.completed` with no assistant text, then `session.ended`.
- The job's next step, marking its ledger entry `sent`, never ran. The next run blocked on the unconfirmed entry.

**End-to-end, QA Lab** (real gateway, cron scheduler, qa-channel, mock-openai; the Codex cell runs the real `codex app-server`). New scenario `cron-send-then-continue` covers delivery modes `none` and `announce`. In each, the model sends to the delivery target without `final`, then writes a marker file, then finishes.

| | embedded | codex |
|---|---|---|
| main `6d14590f417` (no fix) | fail: one request, turn ended after send | fail: one request, turn ended after send |
| this PR | pass: send, then `write`, one channel message per mode | pass: send, then `bash`, one channel message per mode |

Each runtime cell's scenario details now include the request trace for each delivery mode (`message -> next tool -> final`, plus what qa-channel received). This run is at the PR head:

```text
codex     none: message -> exec_command -> final; channel=["QA-CRON-SEND-CONTINUE-SENT"] | announce: message -> exec_command -> final; channel=["QA-CRON-SEND-CONTINUE-SENT"]
embedded  none: message -> write -> final;        channel=["QA-CRON-SEND-CONTINUE-SENT"] | announce: message -> write -> final;        channel=["QA-CRON-SEND-CONTINUE-SENT"]
```

On main, both cells stop after the first request: `requests=[{"tool":"message",...}]`, and no further tool call follows.

**Regression scenarios on both runtimes:** 10 message-tool, cron, sub-agent and A2A scenarios, run under `--runtime-pair openclaw,codex`.
- Pass, with no change in the chat paths: `group-visible-reply-tool`, `message-tool-stranded-final-reply`, `group-message-tool-unavailable-fallback`, `cron-send-then-continue`. `runtime-tool-message-tool` skipped.
- Fail: `cron-failed-tool-terminal-finalization` (Codex cell), `a2a-message-tool-mirror-dedupe`, `message-delivery-decision-inspection`, `subagent-forked-context`, `yield-rejection-no-warning` (Codex cell). Each fails in the same runtime cells on unpatched main `6d14590f417` on this host, so these failures already exist on main and are not caused by this change.

**Unit:**
- New matrices in the Codex dynamic-tool and embedded terminal-hook suites, plus a cron run assertion. On main, exactly the bug cells fail (7 failed); with this PR all pass.
- 17 affected files, 572 tests, all passing. This includes the existing duplicate-reply protection suites (`message-tool-terminal*.test.ts`, `dynamic-tools.source-reply`, `run-attempt-lifecycle-controller`, `event-projector.source-finish`, `message-tool-execution`) and `agent-tools.prefix-stability`, all unchanged.

**Lint:** `oxlint --type-aware` reports `max-lines` on `run-attempt-dispatch.ts` and three unresolved-type errors in `dynamic-tools.ts`. All four already appear on main with the same local setup.

Co-authored-by: Ayaan Zaidi <[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 docs Improvements or additions to documentation extensions: codex extensions: copilot merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant