Skip to content

fix(agents): settle owned orphan transcript repair - #133243

Merged
steipete merged 3 commits into
mainfrom
codex/frv-projection-owner
Aug 30, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/frv-projection-owner

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem and repair

Full release QA parity failed while an embedded attempt repaired an orphaned user turn. The repair rewound its in-memory cursor and replayed trailing metadata, leaving the persisted active projection dirty. A subsequent append adopted the canonical storage parent and synchronously reopened the bounded transcript before that projection was ready, throwing SessionTranscriptProjectionUnavailableError. Without trailing metadata, the cursor change was never persisted at all.

The embedded attempt boundary now uses the existing fenced leaf-control append to record its repaired cursor, replays metadata, and joins the projection work already scheduled for that target. Its already-asynchronous caller runs this preparation inside the existing owned transcript-write lifecycle and passes the run's abort signal. Cancellation is checked before repair and after the wait. The next append sees the canonical repaired path; the historical orphan remains in the append-only record.

This changes the mutation owner rather than retrying fresh reads. Generic synchronous SessionManager APIs and fail-fast bounded reads remain unchanged. There are no new SQL statements, schemas, migrations, indexes, configuration settings, transaction boundaries, retention policies, or recovery mechanisms. The existing leaf-control contract is also used when withdrawing rejected assistant drafts.

Production is net +20 lines across two modules. That growth records the previously missing durable cursor update and joins its asynchronous projection under the existing lifecycle; the competing unowned synchronous preparation call is removed. Tests and test-support changes are net +112 lines, separately from one changelog line.

Verification

Four real-SQLite branch/reset cases, each with and without trailing metadata, failed before the fix. They now verify that a fresh bounded reader excludes the orphan while raw history retains it, and that a real out-of-band append is adopted with the correct transcript anchor.

Cancellation coverage holds an actual reconcile worker at its existing acknowledgement boundary, aborts the wait, and verifies that repaired prompt state is not published. Pre-abort and stale-writer cases reject without changing durable rows. Existing raw-probe, settled-finalization, current-user preservation, branch/idempotency, fresh dirty-read, and reconciliation-lifecycle checks are included in the focused proof.

All 74 tests passed across nine files (83.33 seconds wrapper time). Managed Codex review passed through P2 with no actionable findings. The first full changed-file gate caught a test-fixture type mismatch: the writer fence belongs in the owned context, not the runtime target. The test now uses that canonical context; all 23 owner tests and the affected test typecheck pass. The final complete changed-file gate passed, including core and all core-test typechecks, lint, schema and ownership guards, and import-cycle checks. This follow-up changes only the test file; production is byte-identical to the fresh hosted QA parity target. Exact PR CI and hosted results are recorded below. This PR does not claim that the failed full release run is green; a fresh complete verification is still required after the repairs land.

Hosted proof and review disposition

Focused release checks 33305374796 passed on the unchanged production fix at 9a0793a25a435890800895847773226ff7f95781, using frozen trusted tooling 3ed6805a6f32ad8cdfd3c30dd94d7ae4d75bd667. Baseline and candidate each passed 12/12 without retries, including the formerly failing capability-change scenario. Runtime core passed 25/25, soak 2/2, and explicit restart 1/1. Both artifact digests were verified. The existing nested Codex compaction harness-gap skip remains; this focused run is not the subsequent full/all verification.

The latest ClawSweeper review judged the runtime repair canonical and its +20 production lines justified. Its only finding and Rank-up move requests changelog removal. That request is explicitly declined: this maintainer-directed release-validation task carries a standing instruction to include changelog entries for user-visible fixes. No additional runtime change is needed for that policy preference.

The corrected-head PR CI exposed seven older context-engine fixtures whose shared test double omitted the existing SessionManager method now used by the repair. A three-line fixture correction declares, initializes, and resets getSessionTarget to return undefined, matching the real in-memory manager. All 94 tests across the ten shared-harness files pass, including all seven original failures with unchanged assertions; affected test types and formatting pass. Managed Codex review is clean through P2. Production remains byte-identical to the hosted proof target. Exact-head CI 33306869917 passed for 586f3464b7d66ee0e79f4c286e2a2a86ed19ff6f; all 185 jobs are terminal with no failed jobs.

@clawsweeper

clawsweeper Bot commented Aug 30, 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 agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Aug 30, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 30, 2026, 6:42 AM ET / 10:42 UTC.

ClawSweeper review

What this changes

The branch makes orphaned transcript-cursor repairs durable through the owning writer and waits for their projection before an embedded agent attempt continues.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this maintainer-authored PR open: the owner-bound transcript repair remains needed on current main, but the still-present direct CHANGELOG.md edit violates the repository’s release-owned changelog policy.

Priority: P2
Reviewed head: 586f3464b7d66ee0e79f4c286e2a2a86ed19ff6f

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The owner-bound repair is well targeted, but the unresolved release-owned changelog edit prevents a higher patch rating.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR; its supplied body nonetheless describes focused hosted real-SQLite and cancellation evidence for the changed owner boundary.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR; its supplied body nonetheless describes focused hosted real-SQLite and cancellation evidence for the changed owner boundary.
Evidence reviewed 7 items Repair implementation: The introduced repair records a leaf-control cursor update, waits for the target projection with the run abort signal, and only then publishes repaired prompt state.
Owning caller: Runtime preparation now awaits the boundary inside the existing owned transcript-write lifecycle and passes the run abort signal.
Projection contract: The existing projection waiter polls only while the requested session remains dirty and honors abort signals, matching the new await boundary.
Findings 1 actionable finding [P2] Remove the release-owned changelog edit
Security None None.

How this fits together

Embedded agent attempts prepare model-session state from persisted transcript events. When an orphaned user turn is removed, the repaired cursor and its projection must settle before another transcript append reads that state.

flowchart LR
A[Persisted transcript] --> B[Embedded attempt setup]
B --> C[Writer-owned cursor repair]
C --> D[Projection reconcile]
D --> E[Prepared model session]
E --> F[Later transcript append]
Loading

Before merge

  • Remove the release-owned changelog edit (P2) - CHANGELOG.md is release-generated in this repository; retain the existing release-note context in the PR body or squash message instead. This repeats the prior unresolved finding because the introduced line remains at this head.
  • Resolve merge risk (P1) - The direct edit to release-owned CHANGELOG.md can conflict with or be superseded by release generation; the PR body already contains the needed release-note context.
  • Resolve merge risk (P1) - Production is net +20 lines for the durable cursor update and projection wait; that growth is justified by the previously missing owner-boundary operations and should remain limited to this repair.
  • Complete next step (P2) - A narrow mechanical removal of the release-owned changelog line resolves the sole remaining blocker without changing the verified runtime repair.

Findings

  • [P2] Remove the release-owned changelog edit — CHANGELOG.md:80
Agent review details

Security

None.

PR surface

Source +23, Tests +109, Docs +1. Total +133 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 34 11 +23
Tests 2 288 179 +109
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 323 190 +133

Review metrics

Metric Value Why it matters
Production vs test delta production +20, tests/test support +112, release-owned changelog +1 The runtime growth implements the missing durable cursor and projection settlement; the separate changelog line is the remaining removable blocker.

Merge-risk options

Maintainer options:

  1. Remove the release-owned changelog edit (recommended)
    Keep the runtime repair and its PR-body release context, but remove the direct CHANGELOG.md entry before merge.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Remove the direct CHANGELOG.md edit and retain the existing PR-body release-note context.

Technical review

Best possible solution:

Remove the direct changelog entry, retain the PR-body release context, and keep the durable cursor update plus projection wait within the existing transcript-writer lifecycle.

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

Yes, source provides a high-confidence path: current main removes the in-memory orphan but does not persist a cursor-only repair or await the dirty projection; the added real-SQLite boundary tests exercise that sequence.

Is this the best way to solve the issue?

Yes for the runtime repair: it uses the existing leaf-control persistence mechanism and owning writer lifecycle rather than weakening bounded reads or retrying downstream. The changelog edit is not part of the best solution.

Full review comments:

  • [P2] Remove the release-owned changelog edit — CHANGELOG.md:80
    CHANGELOG.md is release-generated in this repository; retain the existing release-note context in the PR body or squash message instead. This repeats the prior unresolved finding because the introduced line remains at this head.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ba1be2f427ae.

Labels

Label changes:

  • add merge-risk: 🚨 session-state: The patch changes persisted transcript cursor and projection ordering before later session writes.
  • remove merge-risk: 🚨 other: Current PR review merge-risk labels are merge-risk: 🚨 session-state.

Label justifications:

  • P2: The PR repairs a bounded embedded-agent transcript failure without a demonstrated broad user outage.
  • merge-risk: 🚨 session-state: The patch changes persisted transcript cursor and projection ordering before later session writes.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR; its supplied body nonetheless describes focused hosted real-SQLite and cancellation evidence for the changed owner boundary.

Evidence

Acceptance criteria:

  • [P1] git diff --check.
  • [P1] git diff -- CHANGELOG.md.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Marvinthebored: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Remove the direct CHANGELOG.md entry; the PR body already preserves the release-note context.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-30T10:14:12.289Z sha ea233d7 :: found issues before merge. :: [P2] Remove the release-owned changelog edit

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 30, 2026
@steipete
steipete merged commit 8e1cda9 into main Aug 30, 2026
250 checks passed
@steipete
steipete deleted the codex/frv-projection-owner branch August 30, 2026 10:52
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
* fix(agents): settle owned orphan transcript repair

* test(agents): use canonical transcript writer context

* test(agents): complete in-memory session manager fixture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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