Skip to content

fix(state): preserve legacy results and harden driver close (#201 follow-ups) - #213

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
fix/pr201-followups
Sep 1, 2026
Merged

fix(state): preserve legacy results and harden driver close (#201 follow-ups)#213
ScriptedAlchemy merged 1 commit into
mainfrom
fix/pr201-followups

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Addresses the three unresolved Codex review findings on #201 (and reconciles with #208):

  • P1 — do not replay legacy rows with the current reducer (sqlite.ts:720): during a schema-version migration, legacy event rows with no stored committed result are no longer reconstructed via definition.reduce, which could fabricate states that never existed once the reducer/shape changed. The journal-head row's result is recovered from the authoritative materialized head; earlier unrecoverable rows now fail closed with a typed migration-failure error and an actionable message.
  • P2 — preserve initialization errors when close also fails (sqlite.ts:854): open() now suppresses a runtime.close() failure on the initialization-error path so the original corruption/migration error reaches the caller. The fix(state): keep the sqlite close finalizer infallible (#201 follow-up) #208 infallible-finalizer contract (orDie on the success path) is untouched.
  • P2 — close every store before propagating a close failure: driver close() attempts all store closures, then rethrows the first failure, instead of abandoning later stores after the first rejection.

Tests

  • fails closed when a non-head legacy event has no recoverable committed result
  • migrates a legacy journal-head result from the materialized head without using the current reducer (shape-changing v1→v2 migration)
  • preserves the initialization error when database close also fails
  • attempts every store close before propagating the first close failure

Gates: scoped rstest (83 passed), pnpm typecheck, pnpm lint — all green.

@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1777a66

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@agent-bundle/runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T21:33:20.593938Z 1777a66 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@213
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@213
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@213

commit: 1777a66

@ScriptedAlchemy
ScriptedAlchemy merged commit 941aa08 into main Sep 1, 2026
10 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the fix/pr201-followups branch September 3, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant