feat(runtime): surface semantic request prefix continuity - #4302
Draft
Astro-Han wants to merge 21 commits into
Draft
feat(runtime): surface semantic request prefix continuity#4302Astro-Han wants to merge 21 commits into
Astro-Han wants to merge 21 commits into
Conversation
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Astro-Han
force-pushed
the
feat/4299-semantic-prefix-continuity
branch
from
August 31, 2026 04:02
b96e609 to
deec6d7
Compare
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
latest_contextand Runtime Host, then render it as a compact Desktop Inspector tagStacked on #4300 (
refactor/4299-request-observation-authority). Merge order: #4300, then this PR.Part of #4299. This PR implements Workstream 2 only.
End-to-end lifecycle
flowchart TD subgraph Dispatch["1 · Dispatch and durable authority"] A["Physical model-call dispatch"] --> P{"Select one causal predecessor"} P -->|"first durable root"| P0["none"] P -->|"retry or next tool-loop step"| PA["explicit prior attempt"] P -->|"parent, retry, regenerate, branch, or RootTurnAdmission"| PL["one lineage-derived attempt"] P -->|"compaction, auxiliary, missing, or ambiguous lineage"| PU["unavailable"] A --> D["Host freezes non-secret request domain<br/>connection + provider/model + endpoint/wire<br/>overlay revision + effective proxy basis<br/>credential revisions + provider partition"] A --> O["PR1 observes the prepared semantic request<br/>only when the physical attempt dispatches"] P0 --> M["Canonical ModelCallAttempt"] PA --> M PL --> M PU --> M D --> M O --> M M --> E[("Attempt ledger + RootTurnAdmission")] end subgraph Derive["2 · Runtime-owned continuity derivation"] E --> S{"Stored predecessor kind"} S -->|"none"| N["no_predecessor · 0/0"] S -->|"unavailable"| U["unavailable · 0/0"] S -->|"attempt"| Q{"Both observations exist<br/>and request domains match?"} Q -->|"no"| U Q -->|"yes"| C{"Compare cacheable prior prefix<br/>in semantic order"} C -->|"kind/index/role/label or digest differs"| V["diverged · first divergent segment"] C -->|"opaque segment blocks an exact claim"| K["unknown · known preserved count"] C -->|"entire prior prefix is exact<br/>new tail segments are allowed"| R["preserved · previous/previous"] N --> L["latest_context projection"] U --> L V --> L K --> L R --> L end subgraph Recovery["3 · Restart, copy, and concurrency"] X["Restart"] -->|"cold rebuild from the same ledger"| L B["Branch / conversation copy"] -->|"rewrite attempt links and import retained admissions"| E W["Overlapping turns"] -->|"each follows its own durable admission; no mutable last"| P end subgraph Delivery["4 · Runtime Host to Desktop Inspector"] L --> H["context.diagnostics.query<br/>closed protocol · compatibility epoch 79"] H --> DM["Desktop main passes the Runtime verdict unchanged"] DM --> UI["Inspector tag<br/>Request prefix 8/8 preserved<br/>or diverged at message 3"] PC["Provider-reported cacheRead / cacheWrite usage"] --> CU["Separate provider cache usage display"] endThe authority boundary is deliberate: Runtime selects the predecessor and derives the verdict; the Host transports it; Desktop only controls freshness and presentation. There is no session-wide mutable baseline, append-order or wall-clock fallback, and no edge from provider cache usage into semantic continuity.
Workstream 2 scope
The Runtime reports only
no_predecessor,preserved,diverged,unknown, orunavailable, with previous/preserved segment counts and the first divergent segment when knowable.Comparison is limited to one durable causal lane and the same non-secret dispatch domain: immutable connection identity, provider/model, effective endpoint/wire, request-overlay revision, effective secret-free proxy basis, credential revisions, and an exact known provider/cache partition. Missing observations, historical unqualified attempts, and opaque content never become false
preservedresults. Known segment structure is compared before opaque content.Conversation copy rewrites attempt links and imports the retained RootTurnAdmission chain. The compatibility import preserves frozen historical execution kinds without re-enabling them for new admissions.
The Inspector consumes the Runtime Host conclusion unchanged. It neither hashes content nor selects a predecessor, and it hides an old context verdict while the current Host snapshot is refreshing or failed.
context.diagnostics.queryuses a closed result decoder, so addingrequestPrefixadvances the Runtime Host compatibility epoch to 79; older Clients fail during the handshake instead of rejecting a mid-connection response.Verification
Focused verifier for this PR:
Result: 296 tests passed.
Cumulative verifier for #4300 + this PR adds the Workstream 1 request-shape and AI SDK backend suites to the focused command.
Result: 518 tests passed.
Additional checks:
node scripts/protocol-epoch-check.mjs --base refactor/4299-request-observation-authority: epoch 78 → 79 passednode --test --test-concurrency=1 scripts/protocol-epoch-check.test.mjs: 12/12 passednpm run check:renderer-architecture: 62/62 passedgit diff --check: passedThe full Desktop typecheck remains blocked only by pre-existing
@maka/ui/Astryx type errors forautoScroll,settledText, andtrailingAction; the Desktop main build and all affected Inspector tests pass.Non-goals
computeRequestShapeDiagnostic