Skip to content

Commit 37a4e6b

Browse files
committed
fix(claude): retain native UUID separately from Go lane digest
1 parent 5e502b9 commit 37a4e6b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

devlog/_plan/260912_cache_lane/025_affinity_native.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ MODIFY tests/providers/opencode-go-session-header.test.ts: real handler random/f
1313
MODIFY structure/data-planes/inbound-compat.md final affinity contract to describe private native lane at final canonical destination; mapped links already exist. Preserve source authors. C source audit + diff check, then exact final-tip hosted run tracked in verification cycle. D records missed earlier review scenario and repair head.
1414

1515
Test placement amendment: NEW tests/claude-integration/claude-native-affinity.test.ts and both layout mappings instead of enlarging the existing 600-line Go suite. Same real-handler matrix plus policy wrapper with real core and controlled trace.
16+
17+
C review correction: normalizeLogConversationId hashes its input, so native projection retains raw validated UUID separately; only metadataGoLane uses normalized hash. Preserve fixed historical UUID oracle, no cache-identity migration.

src/server/claude-messages.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,13 @@ async function handleClaudeMessagesWithBudget(
869869
}
870870
// Carry Go identity out of band: a combo's preflight target may differ from its
871871
// actual dispatch/fallback target. Never add Go-only identity to replay headers.
872-
const metadataGoLane = cacheKeySource === "metadata"
872+
const claudeNativeSessionId = cacheKeySource === "metadata"
873873
&& typeof internalBody.prompt_cache_key === "string"
874874
&& isRec(anthropicBody)
875875
&& conversationIdFromClaudeMetadata(isRec(anthropicBody.metadata) ? anthropicBody.metadata : undefined) !== undefined
876-
? normalizeLogConversationId(uuidFromHex(internalBody.prompt_cache_key))
876+
? uuidFromHex(internalBody.prompt_cache_key)
877877
: undefined;
878+
const metadataGoLane = normalizeLogConversationId(claudeNativeSessionId);
878879
// Without any valid conversation identity, fall back to the request-scoped lane
879880
// allocated on the admitted client request (#4172): stable across retries and
880881
// route reconstruction, distinct per request, and never derived from a shared
@@ -927,7 +928,7 @@ async function handleClaudeMessagesWithBudget(
927928
// would fire, disagreeing with the pre-flight decision above.
928929
inboundWire: "anthropic",
929930
claudeGoAffinity: { sessionLane: claudeGoSessionLane },
930-
claudeNativeSessionId: metadataGoLane,
931+
claudeNativeSessionId,
931932
stripClaudeMainAuthForNoncanonicalForward: true,
932933
...(trustedClaudeMainAuth ? { trustedClaudeMainAuth } : {}),
933934
// Claude's internal stored-main enrichment is not an original caller credential.

0 commit comments

Comments
 (0)