Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to **billion-context** are documented here.
Versions follow the merge of a `*_release-v*` branch; CI publishes to npm on tag.

## [Unreleased]

### Changed
- session identity v2.1/v2.2 (`src/session-resolve.ts`): persona tags and the declared model now guard the order-based resolver wired across all four prepares (was: the six-stage persona-anchor ladder). Same-persona traffic owns the raw key through truncation, compaction rewrites, and diverged replays (old fp-equal semantics preserved byte-for-byte on keys); tag changes migrate on head continuity OR header-corroborated model switches (#2241/#2250/#2601/#2719/#2817); tag-less aux lanes ride the raw key only via the old non-anchoring path; strict `|sub:task` / `|sub:aux` guards protect virgin ids (#150/#1916/#970). Real-corpus replay census (495 sessions, 14,656 messages): 45 claims, 311 continues, 0 reanchors, 119 derived-aux, 0 derived-task — zero misattributions.
- Order-primary session identity v2: task-lane keys are discriminated by skeleton hash (`|sub:task:<skel8>`) and the two order-ambiguous corners (shorter-with-aligned-tail, grown-with-rewritten-head) are guarded by the #2791 tail content fragments — a codex-style subagent replay that reuses the main session id can no longer merge into the main compression state (#150), while genuine head truncation keeps claiming raw (#2944, #2942 review).
- **Session identity: order-primary resolver v2 on the wire-neutral domain (#2944, parallel — not wired)** — the
order+id claim skeleton is now minted from `neutralTurns()` (src/affinity-neutral.ts, the #2791 projection that
#2939 already runs on) instead of a third raw-field classifier: content-blind by construction, all four wires
first-class (google `parts`, responses `function_call`), leading system run / client marker turns / image
placeholders stripped by the projection so host machinery cannot misalign the skeleton. Claim rules per the owner
rule: unambiguous client-minted id + main shape (≥3 turns incl. assistant) + head-or-tail order match → raw
(continue/reanchor); shallow blob → `|sub:aux` (#1916 race structurally dead); deep main-shaped stranger →
`|sub:task` guard rail; ids that fail the provenance table stay on the anonymous ladder. Implementation is
ALONGSIDE persona-anchor.ts (old ladder untouched, server not switched); the differential corpus
(tests/issue2944-neutral-skeleton.test.ts) pins the old ladder's behavior first, then runs the same scenarios
through the new resolver with old→new rows — plus the two proofs the raw-field draft could never pass: P6 the
same logical conversation on four wires yields one skeleton and one resolution sequence, P7 system add/remove +
client-marker injection leave the skeleton unchanged.
- **Fold reconcile: marker-mint id churn must not read as substrate destruction (#2815, with #2789)** — covered ids are
content-hash-minted, and any session folded before the raw-stage strip engine (or resent forever by a stateless
client holding marker-laden bytes) carries covered ids minted from artifact-laden content. Once the marker engine
Expand Down
26 changes: 11 additions & 15 deletions src/server/handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { codexCompactGatePre, codexCompactMode, hasCompactionTrigger, isCodexCli
import { emitPreflightError } from "../stream-error.js";
import { agentProviderRecipes } from "../agent-providers.js";
import { affinityToken, conversationHeaderSource, claudeSubagentAgentId, claudeSubagentSplit, clientConversationHeader, codexTurnIdentity, dshPersonaFingerprintApplies, instructionsFingerprintApplies, openaiSystemTextForPersona, preferPromptCacheKeyIdentity } from "../session-id.js";
import { personaNamespace } from "../persona-anchor.js";
import { personaConversationOrder } from "../session-resolve.js";
import { prefixAffinity, type AnonymousAffinity } from "../prefix-affinity.js";
import { buildAnonymousProvenance, type AnonymousProvenance } from "../anon-provenance.js";
import { maybeAdoptForkBlocks, maybeAdoptResume } from "../fork-adoption.js";
Expand Down Expand Up @@ -816,21 +816,19 @@ async function handleRequest(
// (model switch) MIGRATES the anchor instead of forking
// the main lane off the raw key; only history-discontinuous
// requests (review blobs) still fork onto `|sub:<fp>`.
? personaNamespace(
? personaConversationOrder(
anthropicIdentity?.value ?? anthropicSignal,
personaSystemText,
(parsed as AnthropicRequestBody).messages,
log,
personaSystemText,
pluginReportedModel(req.headers),
)
: anthropicIdentity?.value ?? anthropicSignal)
: protocol === "openai"
? (dshPersona && !sideRequestLike
? personaNamespace(
? personaConversationOrder(
openaiIdentity?.value ?? openaiSignal,
personaSystemText,
(parsed as OpenAIRequestBody).messages,
log,
personaSystemText,
pluginReportedModel(req.headers),
)
: openaiIdentity?.value ?? openaiSignal)
Expand All @@ -848,11 +846,10 @@ async function handleRequest(
// discontinuous auto-review blob forks onto `|sub:<fp>`.
// Must sit BEFORE the stableSystemAnchor branch below so a
// plugin request never takes the plain-proxy verbatim anchor.
? personaNamespace(
? personaConversationOrder(
responsesIdentity?.value ?? conversationSignalResponses(parsed as ResponsesRequestBody, convHeader),
(parsed as ResponsesRequestBody).instructions ?? "",
(parsed as ResponsesRequestBody).input,
log,
(parsed as ResponsesRequestBody).instructions ?? "",
pluginReportedModel(req.headers),
)
: opts.stableSystemAnchor && pluginAgentHeader(req.headers) === undefined
Expand Down Expand Up @@ -885,13 +882,12 @@ async function handleRequest(
// the anchor instead of forking the main lane off
// its compression state; a genuinely fresh task
// reusing the id (#150) still forks `|sub:<fp>`.
personaNamespace(
personaConversationOrder(
responsesIdentity?.value ?? conversationSignalResponses(parsed as ResponsesRequestBody, convHeader),
(parsed as ResponsesRequestBody).instructions ?? "",
(parsed as ResponsesRequestBody).input,
log,
pluginReportedModel(req.headers),
)
(parsed as ResponsesRequestBody).instructions ?? "",
pluginReportedModel(req.headers),
)
: (responsesIdentity?.value ?? conversationSignalResponses(parsed as ResponsesRequestBody, convHeader)))
: (responsesIdentity?.value ?? conversationSignalResponses(parsed as ResponsesRequestBody, convHeader));
// #1916/#1307: true when the dsh persona fingerprint actually split
Expand Down
Loading
Loading