Repository navigation
fix(sessions): accepted chat input fails when a same-session announcement runs first - #162473
chuanleiguo wants to merge 3 commits into
Conversation
…ted input Promotion consumes the pending-input row before its owning turn finishes, so a same-session announcement saw that input as an orphan leaf and either repaired it away or replayed it into its own model context. The original turn then failed with "Pending input is no longer active in its admitted transcript". Consumed source owners now keep the aggregate that promoted them, and the attempt boundary checks live in-memory custody before orphan repair. When another live turn owns the input, the boundary skips repair and filters it out of the announcement's agent state and convertToLlm rebuilds.
|
🦞👀 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 2, 2026, 12:10 PM ET / 16:10 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR preserves another live turn’s accepted input during same-session announcements and excludes that input from the announcement’s model context. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. No introduced blocking defect was found, and the previous migration-proof blocker is cleared because the added ownership reference is process-local. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s session runtime promotes accepted chat input into a durable transcript before its turn finishes. Announcement preparation reads that transcript and builds the next provider request. flowchart TD
A[Accepted chat input] --> B[Transcript promotion]
B --> C[Live input ownership]
D[Same-session announcement] --> E[Attempt preparation]
C --> E
E --> F[Announcement provider context]
C --> G[Original turn continues]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +102, Tests +321. Total +423 across 10 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the existing custody owner authoritative through promotion and exclude foreign accepted input throughout announcement context rebuilds. Do we have a high-confidence way to reproduce the issue? Yes: source establishes promotion followed by announcement orphan repair as the failure path, and the contributor reports failing pre-fix boundary cases. This read-only review did not execute a reproduction. Is this the best way to solve the issue? Yes: retaining live custody through the existing owner and filtering at the provider-context boundary is a focused repair without a competing queue or stored-format change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 32e30e59d9a7. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
CI triage for run 36824502245 (head
On the ClawSweeper "persistent data-model change" flag: there is no stored-format change. I will push once, without rebasing for anything else, after the |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
CI update after the upstream fixes landed: pushed one empty commit, 36468d3, with no patch changes or rebase. Fresh CI run 36983749308 tested merge 2bdec7115367 against base e6b3a11, which includes both the ripgrep provisioning and readMissingScopeError import fixes. It finished with 92 jobs passing, 23 skipped, and one failing test job plus the aggregate CI gate. All 14 companion workflows passed. The remaining failure is test/scripts/write-unified-entry-dts.test.ts:241, “reuses unaffected canonical groups while rebuilding runtime after input edits”. Its temporary package fixture exports only ./error-coercion, while src/process/exec-result.ts imports @openclaw/normalization-core/record-coerce, producing ERR_PACKAGE_PATH_NOT_EXPORTED. Source inspection points to an existing base fixture mismatch; both files are outside this PR’s diff. I have not independently reproduced it locally. |
Merge upstream/main at 0845ecd into fix/preserve-foreign-live-input, retaining both histories and upstream runtime-context projection tracking. Await the updated history APIs in the live-input regression fixtures. Publish aggregate custody back to the host after the metadata writer commits, so an announcement cannot repair or consume another live turn. Keep the live-owner lookup in its own module within the line budget. Extend the real writer-worker regression to verify foreign protection, own-context access, and release after cancellation. Validation: 143 focused tests passed; the 59 affected regressions also passed after extraction. Independent autoreview returned scoped-clean with no actionable P0-P2 findings. Core production types and selected architecture checks passed; remaining validation is recorded separately.
|
Superseded by #163655, rebuilt as one focused commit on fresh upstream main. |
Supersedes #160962, narrowed to the core fix.
What Problem This Solves
Fixes: an accepted chat turn fails with
Pending input is no longer active in its admitted transcriptwhen a same-session announcement (for example a subagent completion) runs while that turn's input is promoted but not yet finished.User Impact
Announcements no longer treat another live turn's accepted input as an orphan. They leave it in the transcript, keep it out of the announcement's model context, and the original turn then runs exactly once. Cancelled or revoked input is still never executed. No config, schema, stored-format or migration change.
Why This Change Was Made
Promotion consumes the pending-input row before its owning turn finishes, so orphan repair could not see that the input still had a live owner. Consumed source owners now keep a reference to the aggregate that promoted them, and the attempt boundary checks in-memory live custody (same database, session and transcript entry, owner still current) before it repairs or replays an orphan. When another turn owns the input, the boundary skips repair and filters that input out of agent state and every
convertToLlmrebuild for this attempt.The pre-adoption lifecycle reservation and the Bedrock distinct-user-turn replay from #160962 are separate concerns and are left for follow-up PRs.
Evidence
Base:
origin/main558d38a3db5.attempt-session-boundary.live-input.test.tsfails 2/3 cases on unpatched main (live collected input, revoked input). In both, the announcement's provider request contains the other turn'squeued user request. TheexcludeFromContextcase passes on both, as the control.attempt-session-boundary.live-input.test.ts,session-accessor.pending-inputs-consumed.test.ts, and the existingattempt-session-boundary.test.tspass 89/89.pnpm test src/agents/embedded-agent-runner/run/attempt-session-boundary.live-input.test.ts --maxWorkers=1takes 24.9 s wall and 8.1 s Vitest duration (3 cases at ~1 s each, real SQLite plus the real attempt boundary andconvertToLlm). The new accessor cases inpending-inputs-consumed.test.tsare in-memory and cheap.node scripts/check-changed.mjs --staged: these pass: format, conflict markers, line-cap, max-lines, assertion SAFETY, SQLite worker, timeout-race ratchets, plugin boundaries,typecheck core, and theagents-root,agents-other,agents-toolsandagents-sessionstest-type graphs.checks-node-changed-compact-large-39. The three newpending-inputs-consumedcases took 0.53 s inchecks-node-changed-compact-large-31.promotedOwneris a process-local field on the in-memory owner. Transcript,session_pending_inputsand session rows are unchanged, so update and migration behavior is unaffected.chat.send,sessions_spawn, child completion and announcement. The announcement request contained zero copies of the queued input. The original turn then ran once with one copy. Achat.abort-cancelled input produced no provider request.Known limits (unchanged from #160962, not addressed here)
AsyncLocalStorage. An announcement that inherits a live parent's owner context would treat that parent's input as its own. This is unlikely because a spawning turn already has an assistant entry after its input. Passing the attempt's owner explicitly would remove the dependency.