Skip to content

Preserve managed recovery authority and prepare SDK 0.1.1280 - #5260

Merged
kojiwakayama merged 4 commits into
mainfrom
chore/managed-recovery-authority-followup-20261018
Oct 18, 2026
Merged

kojiwakayama merged 4 commits into
mainfrom
chore/managed-recovery-authority-followup-20261018

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Managed recovery must preserve ownership and durable acknowledgements after application code runs. This follow-up to #5213 captures mutable Promise, Map and filesystem operations; keeps lease renewal active until the actual producer settles; keeps public snapshot parsing free of provider provenance; and validates initial snapshots before committing their external cursor. Built-in transport, model-readiness and memory failures report their lifetime before preflight, allowing known empty startups to retire while unknown producers and failed cleanup remain fenced.

Prepares SDK 0.1.1280 through synchronized package, runtime and generated hydration versions so the normal release pipeline can publish the fixes.

Validation: pinned Deno 2.9.7 production checks; 173 recovery/session/stream tests and 137 steps; six deferred-producer tests with explicit operation/resource sanitizers; regressions reproduced against the previous implementation; required current-base review. Exact-head packed-runtime qualification passed: supported Linux npm build, shipped-module graph without source fallback, 19 API provenance tests, API typecheck across 4,862 canonical source files, and real HTTP/PostgreSQL SIGKILL recovery with one execution of the acknowledged effect. Normal publication and staging acceptance remain separate gates.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-10-18T00:02:48.482377Z a26043e Manual request
ℹ️ 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.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 65 362 KiB ✅ 0
src/react/components/Head.tsx 5 74 KiB ✅ 0
src/react/router/index.tsx 5 74 KiB ✅ 0
src/react/context/index.tsx 5 74 KiB ✅ 0
src/react/fonts/index.ts 6 81 KiB ✅ 0
src/react/components/ui/index.ts 111 717 KiB ✅ 0
src/react/components/ui/adapter/contract.ts 1 18 KiB ✅ 0
src/react/components/ui/icons/index.ts 3 17 KiB ✅ 0
src/chat/index.ts 301 2017 KiB ✅ 0
src/chat/ag-ui.ts 61 457 KiB ✅ 0
src/chat/protocol.ts 1 11 KiB ✅ 0
src/chat/types.ts 45 242 KiB ✅ 0
src/chat/message-prep.ts 65 509 KiB ✅ 0
src/markdown/index.ts 6 30 KiB ✅ 0
src/mdx/index.ts 2 2 KiB ✅ 0
src/agent/identity-contracts.ts 1 2 KiB ✅ 0
src/schemas/index.ts 42 216 KiB ✅ 0
src/platform/env.ts 5 53 KiB ✅ 0
src/workflow/claude-code/react/index.ts 9 91 KiB ✅ 0
src/events/index.ts 31 568 KiB ✅ 0
src/events/ag-ui/public.ts 30 561 KiB ✅ 0
src/run-events/index.ts 53 317 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@github-actions

Copy link
Copy Markdown

@codex review

Copy link
Copy Markdown
Contributor

Score: 74/100 Sound hardening and good regression tests, but the lease-lifetime change leaves paths where renewal never stops.

  • Strength: Captured Promise, Map and fs primitives are applied consistently. The tests deliberately replace prototypes (Promise.then/catch, Map.get, FileHandle/Stats/Dir) and assert real behavior. Deferred-producer tests run with op/resource sanitizers.
  • Strength: Validating the initial snapshot with placeholder cursors before publishing is a good invariant. The test confirms zero appends on invalid history.
  • Strength: The version bump is synchronized across deno.json, version-constant.ts, the lockfile and the generated hydration runtime.
  • Concern (blocking-ish), src/internal-agents/run-stream.ts ~L2365-2445: The unconditional recoveryLifetime?.stop() in the stream finally was removed. It is now called only inside the producerCompletion .then handlers. If closeSandbox() fails (sandboxClosed is false), or sandboxClosed is true with no producerCompletion (the else if (sandboxClosed) branch, e.g. an override runtime that never calls onStreamCompletion), nothing stops the lifetime. The renewal timer keeps renewing ownership indefinitely after settledStop("abandoned"). Suggested fix: stop the lifetime in those branches, or when no producer is known, and add a test for the no-completion and sandbox-close-failure paths.
  • Minor, recovery-snapshot.ts: parseRecoverySnapshot now parses the schema twice on every call. If this is a hot path, add a comment on the cost or find a cheaper way to strip provenance. The same applies to the placeholder-cursor validation, which duplicates a full parse on initial publication.
  • Minor: The bare { ... } block in wait() in managed-recovery-writer.ts is a leftover scope. Remove it. The PR description mentions staging acceptance as a separate gate, so confirm it before release.

Generated by Claude Code

@kojiwakayama

Copy link
Copy Markdown
Contributor Author

Assessed the lease-cleanup concern against the actual producer and session retirement contract. settledStop("abandoned") does not establish that the original producer has stopped. A missing onStreamCompletion callback leaves producer state unknown, and failed sandbox cleanup likewise provides no positive termination evidence. Stopping renewal in either branch would let another generation start while an original callable effect may still execute. The implementation therefore retains the ownership fence until both producer completion and successful cleanup are established, or ownership is externally revoked/lost.

The concrete regression tests reproduce premature renewal loss on client disconnect and post-invocation setup failure against the previous implementation, and pass with the published repair. The six deferred-producer fixtures now forward their actual completion and pass with explicit operation/resource sanitizers. The real packed-runtime HTTP/PostgreSQL SIGKILL-and-replacement proof also passes with one acknowledged effect execution. I am retaining the fence rather than applying the suggested unconditional stop. Duplicate parsing is intentional to keep public parsing free of private provider provenance; the formatting suggestion is optional. Hosted review/CI and actual staging acceptance remain pending.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0106c19edc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/internal-agents/run-stream.ts
@kojiwakayama
kojiwakayama marked this pull request as draft October 17, 2026 23:39
…etimes

Capture mutable Promise, Map and filesystem operations on managed recovery paths, keep leases through producer settlement, separate public parsing from provider provenance and validate initial checkpoints before publishing. Update custom test producers to report actual completion without relaxing unknown-producer fencing.

Related: SDK #5213 review findings 4304903774, 4304903777, 4304903781, 4304903784
Tested: Pinned Deno 2.9.7 production check; 170 integration tests and 137 steps; six explicit resource-sanitized deferred producer cases; format and lint
Tested: Required uncommitted review; its sibling test completion finding addressed with red/green coverage
Not-tested: Fresh packed crash qualification, hosted CI and staging acceptance remain
Confidence: high
Scope-risk: moderate
Prepare SDK 0.1.1280 through the existing version helpers and generator. Keep package metadata, workspace lock, runtime constant and embedded hydration runtime synchronized so the normal main release workflow publishes the repaired cohort.

Tested: Required uncommitted review; its runtime-version finding addressed through generated artifacts
Tested: Supported generation task, release-version tests, whitespace checks
Not-tested: Public publication and staging acceptance remain
Scope-risk: narrow
Tested: Required uncommitted review clear; all 22 focused writer tests; full formatting and lint checks
Scope-risk: narrow
The built-in runtime could reject transport, model-readiness or memory preflight before reporting its producer lifetime. Managed recovery then treated a known empty startup as an unknown producer and retained session capacity. Reserve completion before preflight and settle it on failure only while no producer has started. Mark runtime invocation at the actual dispatch boundary.

Rejected: Stop renewal whenever completion is missing | an invoked override or failed sandbox cleanup can still leave effects running
Confidence: high
Scope-risk: moderate
Tested: Original real-owner startup regression fails before repair; focused cancellation/recovery tests and positive invocation-boundary cases pass; production typecheck, formatting, lint and required review
Not-tested: Final normal publication and staging lifecycle acceptance remain
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

@kojiwakayama
kojiwakayama force-pushed the chore/managed-recovery-authority-followup-20261018 branch from 0106c19 to a26043e Compare October 17, 2026 23:59
@kojiwakayama
kojiwakayama marked this pull request as ready for review October 17, 2026 23:59
@github-actions

Copy link
Copy Markdown

@codex review

@github-actions

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: a26043e064

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kojiwakayama

kojiwakayama commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Merged through the normal queue at dcbac8c3d1bb827e3db208b8bd9682e3d4121ae4; npm 0.1.1280 is published.

Post-publication qualification checked the actual registry tarball integrity and all 9,477 installed API-consumer files. The real HTTP/PostgreSQL checkpoint → owned process SIGKILL → replacement → authenticated full restore → native completion test passed against the published package, with one acknowledged effect, one replacement model call and two original tool starts. All 28 observed production modules came from the installed package, with no source fallback. The Node 22 prototype-poisoning probe also passed.

This qualifies the published package for consumer integration. Compatible API/server publication and actual staging lifecycle, email comparison and OKF acceptance remain; this is not a staging completion claim.

@kojiwakayama
kojiwakayama added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit dcbac8c Oct 18, 2026
453 checks passed
@kojiwakayama
kojiwakayama deleted the chore/managed-recovery-authority-followup-20261018 branch October 18, 2026 00:57
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.

2 participants