Repository navigation
fix(agents): preserve history when context assembly fails - #117328
Conversation
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 2:28 PM ET / 18:28 UTC (Revision 19). ClawSweeper reviewWhat this changesPreserves ordered conversation history when context-engine hooks mutate the message array and fail, adds failure and recovery coverage, and extracts shared test fixtures. Merge readiness✅ Ready for maintainer review Keep open: the post-tool rollback remains useful beyond the merged assembly-isolation fix, and no actionable introduced defect was found. The maintainer-protected PR is not eligible for automatic cleanup. Priority: P2 Review scores
Verification
How this fits togetherContext engines prepare conversation history for the next model request. The embedded runner invokes their lifecycle hooks after tool results arrive, then uses assembled context or falls back to the existing history. flowchart TD
A[Conversation and tool results] --> B[Snapshot ordered history]
B --> C[Context engine hooks]
C --> D{Assembly succeeds?}
D -->|Yes| E[Use assembled context]
D -->|No| F[Restore history and retry fence]
E --> G[Next model request]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +121. Total +123 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep rollback in the existing tool-loop owner, preserving message identity, successful windowing, cancellation, and pending-turn boundaries. Do we have a high-confidence way to reproduce the issue? Yes, from source: an unmarked history array passed to a non-deferred afterTurn hook can be spliced and then returned corrupted after the hook throws. The added regression exercises this path; execution was not performed. Is this the best way to solve the issue? Yes. Restoring array membership at the existing lifecycle boundary closes the remaining gap while respecting the established shared-message-object contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b31ad046ef90. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (18 earlier review cycles; latest 8 shown)
|
Security-sensitive guard clearedThis PR no longer has blocked security-sensitive file changes. A future security-sensitive change requires a fresh
|
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
…149230) Bind native PR initialization to GitHub's authoritative node/database ID pair while preserving exact historical repository objects and recovery provenance. Reject unknown identities, numeric strings, and extra fields. Consume the landed prerequisite unchanged for #117328 CI fixture repair. (cherry picked from commit 7e8a52c)
Merge retained fixture correction bdf98b3 with acquired main 43286ef. The resulting main-relative delta is exactly the three reviewed Context history files. Preserve original PR and fixture ancestry without rewriting. Co-authored-by: Peter Steinberger <[email protected]>
Preserve the reviewed Context rollback composition and original contributor ancestry in a signed merge adoption for same-branch publication. Co-authored-by: Peter Steinberger <[email protected]>
Move unchanged message and guard fixtures into a shared test-support module. Preserve every test body and keep the line-cap configuration unchanged.
|
Merged via squash.
|
…17328) * fix(agents): restore history after failed context assembly * fix(agents): restore validated history after failed context hooks * fix(scripts): preserve merge receipts across repository ID formats (openclaw#149230) Bind native PR initialization to GitHub's authoritative node/database ID pair while preserving exact historical repository objects and recovery provenance. Reject unknown identities, numeric strings, and extra fields. Consume the landed prerequisite unchanged for openclaw#117328 CI fixture repair. (cherry picked from commit 3492551) * test: refresh repository identity fixtures for PR workflows Consume Peter's canonical openclaw#149289 fixture repair unchanged. Original 133-case proof retained with exact fixture, runtime, runner and dependency bindings; no replay. (cherry picked from commit 89321f8) * test: align native PR identity fixtures with landed repair Preserve the two remaining fixture corrections from Peter Steinberger's landed openclaw#149294 after adopting the earlier openclaw#149289 repair. Both files match the landed source exactly; Context history source is unchanged. Source-commit: 3df0afa * test(agents): extract context guard fixtures for line caps Move unchanged message and guard fixtures into a shared test-support module. Preserve every test body and keep the line-cap configuration unchanged. --------- Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes conversation and tool-result history being lost when a context-engine hook mutates the message array and then throws or returns malformed assembled context.
User Impact
Failed context assembly preserves the original ordered model-visible history and message identity instead of dropping instructions or tool results. Successful context windowing, cancellation, and retry behavior remain covered.
Why This Change Was Made
The post-tool owner snapshots history before plugin hooks and restores the same array in place on failure, preserving caller identity and retry fences. Startup already has the canonical isolation fix from #125714; the owning runner retains that behavior and adds malformed-result coverage. Pending tool turns and token-budget handling are preserved.
The signed published head is
f90a6fc156d21be04bebceadee7cf92c58c879a2, treecfd4e3d976331a8b75a53954cd2e192517389e48. It retains the reviewed real integration20d56e64127f616d489fef2d5dc95c4e190f95d2, fixture correctionbdf98b30d79954ea0343e08c14690abbc4cf501d, acquired main43286efa75666f29030bdd9c93873410698dc79c, and previous published ancestry.Peter Steinberger's original commit
5bb11e9ae7fc77d9f39cca908521630e04a88e66and contributor attribution remain intact. GitHub verifies the new publication signature by fuller-stack-dev; historical unsigned commits are not relabeled as signed.Scope and Evidence
f90a6fc156d21be04bebceadee7cf92c58c879a2and lock SHA256a6a6f2aecc88c5a04c7f268a2ffbbc998deead2567e7161773f753b7ca4370c2: 139 owning tests passed (77 post-tool, 62 startup); core types and owning agent-test types both passed. Synthetic context plugins exercise production owner boundaries; no real provider accounts were used.Remaining Gates
Exact-head CI is still active. New-head security detection succeeded; required enforcement and governance remain separate gates. This does not identify or erase the historical HTTP500 detection failure.
The completed local review remains NEEDS WORK pending required hosted CI/security/governance. No native READY stamp, preparation, merge approval or landing is claimed. Release-manager and secops review requests remain in place. No broad local suite/build, CI retry/cancellation, or watcher was introduced.