Repository navigation
fix: retain CLI conversations when child completions arrive - #164378
Conversation
Prepare stable reply-policy binding facts for ordinary direct-agent calls and synthetic completions. Preserve published default-policy sessions and provide effective delivery guidance as private current-turn context without changing canonical user prompts.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 11:38 AM ET / 15:38 UTC. ClawSweeper reviewWhat this changesThe PR preserves CLI-backed conversations across child-completion turns by sharing stable reply-policy facts, recognizing equivalent published defaults, and supplying delivery guidance separately from stored user messages. Merge readiness✅ Ready for maintainer review This remains a useful fix: current main still treats ordinary-call and completion-call reply fingerprints differently. No actionable introduced defect was found; related announcement-history work addresses an additional, distinct continuity problem. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw's CLI runner translates agent requests into turns for an external AI CLI. It checks saved conversation bindings before resuming them and prepares prompts and tool context for the selected backend. flowchart TD
A[Direct agent request] --> C[Stable session reply policy]
B[Child completion update] --> C
C --> D[Conversation compatibility checks]
D --> E[Resume or start CLI conversation]
B --> F[Current turn delivery guidance]
F --> E
E --> G[Reply and transcript settlement]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +69, Tests +320, Docs +9. Total +398 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain native CLI continuity for equivalent session policies while keeping per-turn guidance separate and preserving account, workspace, and tool compatibility boundaries. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the fingerprint mismatch between ordinary direct calls and subsequent synthetic completion calls; the PR supplies focused before-fix regressions. This review did not execute a runtime reproduction. Is this the best way to solve the issue? Yes, reusing the existing reply-policy owner and narrowly admitting equivalent published defaults repairs the mismatch without dropping MCP or authentication compatibility checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a163d9b3db61. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…#164378) Prepare stable reply-policy binding facts for ordinary direct-agent calls and synthetic completions. Preserve published default-policy sessions and provide effective delivery guidance as private current-turn context without changing canonical user prompts.
Report by the VPS agent, 2026-10-12 (dev-mode/claude-sub/ bug-cron-session-target-cli-amnesia.md, phone number redacted): a cron job with sessionTarget "session:<chat key>" and the default announce delivery runs in the chat's session, but upstream hands the run's delivery plan (requireExplicitMessageTarget: true) to the CLI runner as the session's binding facts. messageToolPolicyHash then differs from the chat's, resolveCliSessionReuse resets the Claude CLI session (reason=message-policy) and settlement stores the cron hash on the chat row, so the next chat turn resets again: the chat agent forgets everything twice per run. Fork-owned src/cron/isolated-agent/fork-cron-cli-binding-facts.ts: a run that reuses a persistent non-cron session binds with upstream's resolveSessionStableReplyMode and no requireExplicitMessageTarget, the rule upstream already applies to heartbeats (openclaw#121485) and agent-command turns (openclaw#164378). The run's delivery rules still apply per turn. Isolated/current runs and cron-keyed sessions keep the per-run facts. One hook in run-executor.ts wraps upstream's three fact lines. Not dev-mode gated. Still open upstream on main 95a27d0 (2026-10-16). Fork test fork-cron-cli-binding-facts.test.ts (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Fixes CLI-backed parent sessions losing their native conversation when a child-completion update arrives, which can prevent the expected completion reply from reaching the transcript.
User Impact
Child-completion turns retain the parent conversation and receive delivery instructions for the current turn. Existing sessions using the published implicit automatic-reply policy keep continuity after updating; their next completed turn records the current policy without operator action.
Why This Change Was Made
Ordinary direct-agent calls and synthetic completion calls now derive reusable reply policy from the same owner. Turn-specific delivery instructions remain outside the stable system prompt and stored user message. Binding admission recognizes only the three verified equivalent default-policy representations; authentication, workspace, MCP compatibility, and nondefault policy changes retain their existing checks.
Evidence
The original Docker CLI failure is recorded in Full Release Validation child 37119616846: the initial barrier, parent reply, and child delivery passed, then the completion turn reset for
message-policyand failed the third transcript wait.The real command-to-CLI preparation regressions failed before the fix for new, existing, and published default-policy sessions. The effective-delivery regression also failed before current-turn guidance was added. Focused proof preserves native session identity, transcript bytes, private plugin context, unavailable-tool guidance, and strict auth/workspace/MCP checks.
All 174 affected tests passed. The standalone regression command
pnpm test src/agents/cli-runner/prepare.command-continuity.test.ts --maxWorkers=1passed five cases in 88.18 seconds, including compiler and fixture setup (25.319 seconds of case execution). Full required changed checks passed, including formatting, types, lint, size limits, export and import-cycle guards. Final isolated review found no actionable P0–P2 findings. Live-provider behavior remains unqualified. One approved standard Testbox attempt remained queued without a runner or Actions URL beyond its ten-minute admission window and was released before any remote command or provider call; the live Docker lane did not run.CI timing evidence from completed run 37133560587, on the reviewed head:
src/agents/cli-runner/prepare.command-continuity.test.tssrc/agents/cli-runner/prepare.durable-context.test.tssrc/agents/cli-runner/prepare.test.tssrc/agents/cli-session.test.tsThese are the executed per-file test-wrapper timings, including their preparation overhead. The new continuity suite ran in
checks-node-changed-3; the other three files ran inchecks-node-changed-4. The live Docker lane remains unrun.