Skip to content

feat(google): capture terminal continuation checkpoints privately - #31

Open
hypn4 wants to merge 5 commits into
Deuz-AI:mainfrom
hypn4:feat/google-native-continuation
Open

hypn4 wants to merge 5 commits into
Deuz-AI:mainfrom
hypn4:feat/google-native-continuation

Conversation

@hypn4

@hypn4 hypn4 commented Oct 16, 2026 •

Copy link
Copy Markdown

Refs #22. This is the first capture-only slice, not automatic long decode or crash recovery.

Changes

Add optional onContinuationCheckpoint to the native Google and Vertex factory settings. At a completed hop with a nonempty token in the terminal CONTINUATION or MAX_TOKENS frame, provide the detached original request body, provider/model, API version and per-hop usage to an awaited server-side callback. Configured keys and auth headers are not included. No token or private request is added to public stream metadata.

The existing caller/total deadline applies to storage. A storage failure is sanitized and fails the call without retrying the model. The received final usage is recorded before storage, so a storage failure does not discard it. Loading the storage helper is deferred until opt-in is actually used.

A continuation boundary still ends with length, now accompanied by an explicit incomplete-output warning. No additional HTTP request is made and no output, timeout or execution budget is raised. The 36 tests cover request detachment, UI privacy, final usage, invalid/stale tokens, typed failure, cancellation, deterministic total deadlines and no incomplete-turn tool execution.

Deliberate limits

This does not retain in-flight checkpoint tokens, pair a checkpoint atomically with an emitted-output cursor, auto-resume, deduplicate output, or add cross-process recovery. An earlier token without a matching terminal-frame token is not offered as a terminal checkpoint. MAX_TOKENS must not be blindly resumed with the same cap or an automatically increased cap. Store the private material under the run owner; this is not an encrypted storage implementation.

The existing Vertex transport remains v1. Cloud release notes explicitly limit long decode to v1beta1, not v1. A synthetic v1 checkpoint test validates capture behavior only, not live support. API-version selection and the long-decode loop need a later reviewed change.

Validation scope

Base: 393439711aca3e46a1ec26b3aa2506de5a1fe922. The added regressions use scripted HTTP/SSE responses and synthetic credentials. They do not establish live model availability or service acceptance. No live Google model, authentication or cloud-resource operation was made. Dependency manifests and lockfiles are unchanged. No generated dist files are committed.

Checkpoint capture is suppressed for any prompt feedback, and the first-content timer is cleared before metadata-only checkpoint storage. The total deadline remains active. The storage helper is a separately measured optional chunk. Its 600 raw / 375 gzip-byte allowance is also added to the existing skills-learning lazy aggregate; no existing eager budget is increased.

Final verification

Checked head: 303a70602727558b1957288db6ea2eb60738ec42. Focused tests: 36/36 passed; core typechecking and the branch-specific build/bundle-size gate passed. The tests use mocked HTTP/SSE and do not make live model requests.

An isolated combined tree containing #21, #23 and these follow-ups passed 7,685 core tests with 407 skipped and one pre-existing macOS Docker command-line-length failure, also reproduced on the unchanged base. Core type tests (131) and React tests (156) passed. The combined tree exceeds several existing bundle-size budgets even though each branch passes separately; integration requires reviewing the cumulative cost. The cache guard and partial-argument guard also touch the same adapter insertion point; both must be retained when resolving that merge.

The combined built package also passed runtime compatibility, public API/ESM/CJS contract, documentation references, strict publint and Are The Types Wrong checks. Packing was run with npm 11 after an explicit build and lifecycle scripts disabled so package inspection did not rebuild or remove declaration artifacts. Lint has no errors; the seven existing live-test warnings remain.

This branch has not been deployed

No deployments
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