Repository navigation
fix: continue after empty post-tool replies - #93062
hannesrudolph wants to merge 2 commits into
Conversation
|
Codex review: needs changes before merge. Reviewed June 14, 2026, 4:29 PM ET / 20:29 UTC. Summary PR surface: Source +123, Tests +472. Total +595 across 10 files. Reproducibility: yes. Source inspection gives a high-confidence path: current main can surface pre-tool assistant text, and PR head can lose the new unclassified-tool safety marker before replay metadata is computed. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Preserve mutationClassified through the embedded attempt normalization path, add a regression that exercises the full runEmbeddedAttempt metadata flow for an unclassified plugin/client tool, then continue with the narrow internal fix instead of the broad public fallback API approach. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: current main can surface pre-tool assistant text, and PR head can lose the new unclassified-tool safety marker before replay metadata is computed. Is this the best way to solve the issue? No, not as submitted. The narrow internal continuation approach is preferable to the broad fallback API PR, but the implementation must preserve the mutation-classification marker through the attempt result boundary before it is safe. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1b8827d20c8. Label changesLabel justifications:
Evidence reviewedPR surface: Source +123, Tests +472. Total +595 across 10 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Origin and reported failure
This PR was born from #90872 and the Discord report that motivated it. The concrete failure is:
Looking into it.cron statusorcron list.{"jobs":[]}.Looking into it.instead of the scheduler result.#90872 addresses this by introducing a broad terminal-tool fallback contract: retained tool observations, public
terminalSummary/terminalResultFallbackmetadata, deterministic synthesized replies, delivery/side-effect evidence, loop-abort handling, plugin SDK changes, and expanded prose classification. Peter rejected that scope and approach as a 15k-line solution that could not be right.This PR isolates the reported failure instead: identify the terminal shape structurally, discard pre-tool narration as a final answer, and perform one bounded continuation from the transcript that already contains the completed result. It does not add public fallback APIs or parse prose to decide whether a turn is complete.
Regression case
The focused runner regression reproduces the exact sequence above:
It asserts that the runner samples exactly once more from the existing transcript, that the continuation prompt explicitly follows the latest completed tool result, and that
Looking into it.is never returned as the terminal reply. Separate tool-lifecycle tests prove that mutation classification uses actualbefore_tool_call-adjusted execution arguments, while terminal-media and unclassified-plugin regressions prove the continuation fails closed.#90872 contains related tests for suppressing pre-tool narration and for synthesizing a cron
terminalSummarywhen Composer provides no final answer, but it does not combine the exact reportedprogress text → read-only cron result → empty assistant → natural final answersequence. Its published live scheduler proof also reported that cron was unavailable in that channel session, so it did not exercise this exact cron path end to end.Summary
before_tool_callis classified from what actually rancron status/listcontinuationThis is a deliberately narrow alternative to #90872. That PR attempts a general terminal-tool fallback contract across 75 files and roughly 16k added lines. Peter’s stated concern was both the size and that this could not be the right approach. This patch addresses the concrete failure without public tool-summary APIs, plugin SDK changes, deterministic tool-output synthesis, or natural-language regex classification of plans/progress/completion.
The decision here is structural: a tool result exists, the terminal assistant turn is empty, no payload/delivery/error/async terminal state supersedes it, and the recorded tool actions are classified replay-safe. The recovery is bounded to one continuation from the transcript that already contains the completed tool result.
Verification
node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.handlers.tools.test.ts src/agents/embedded-agent-runner/run.incomplete-turn.test.ts— 201 passednode scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo— passednode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo— passedoxfmt --checkandoxlintover all 10 changed files — passedgit diff --check— cleanCI=true pnpm check:changedreached and passed both core typecheck lanes, then the type-awaresrc/agentslint shard crashed insidetsgolintwith a GoSIGSEGVand hung; targeted non-type-aware lint passed afterwardReal behavior proof
Behavior addressed: A model can emit progress text, successfully call a read-only tool such as
cron status, then return an empty post-tool assistant turn. OpenClaw previously promoted the pre-tool progress text into the terminal reply and skipped empty-turn recovery.Real environment tested: Repository-native embedded runner and tool lifecycle test harnesses in a dedicated worktree based on freshly fetched
origin/main.Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.handlers.tools.test.ts src/agents/embedded-agent-runner/run.incomplete-turn.test.ts, both corerun-tsgo.mjscommands listed above, targetedoxfmt/oxlint, andgit diff --check.Evidence after fix: The regression covers progress text → read-only
cron status→ empty assistant → one transcript continuation → visible final answer. Additional coverage proves pre-tool narration is not surfaced, terminal media prevents continuation, mutatingcron adddoes not auto-continue, unclassified plugin tools fail closed, hook-adjusted arguments determine mutation state, a real post-tool answer is left alone, and continuation is bounded.Observed result after fix: 201 focused tests passed; both core typecheck lanes passed; targeted formatting, lint, and diff checks passed.
What was not tested: No live Discord delivery or live Composer 2.5 provider call was run. This patch does not synthesize tool output as an answer and does not broaden the plugin/tool public contract. The full changed-file lint lane did not complete because the
tsgolintprocess crashed as described above.