fix(openai): cleanup의 중복 history 판정을 제거한다
This commit is contained in:
parent
ffd2c82f48
commit
a676e35905
2 changed files with 26 additions and 0 deletions
|
|
@ -64,6 +64,26 @@ func TestHotPathCleanupTerminalMatrix(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHotPathCleanupMatchIgnoresCallerHistoryReserialization(t *testing.T) {
|
||||
store := newHotPathLightStore(1)
|
||||
store.records["req_cleanup_history"] = &hotPathLightRecord{
|
||||
requestID: "req_cleanup_history", ownerEdgeID: "edge-a", principalRef: "principal-a", protocol: "anthropic",
|
||||
lineage: logicalRequestLineage{Endpoint: logicalRequestEndpointAnthropic, HistoryDigest: "before", ToolsetDigest: "tools"},
|
||||
phase: hotPathPhaseCleanupPending, pendingKind: hotPathPendingCleanup, pendingHash: "issued-cleanup",
|
||||
pending: map[string]hotPathPendingCall{"call-cleanup": {}}, consumedHashes: map[string]struct{}{}, consumedIDs: map[string]struct{}{},
|
||||
}
|
||||
lineage := logicalRequestContinuationLineage{
|
||||
Prefix: logicalRequestLineage{Endpoint: logicalRequestEndpointAnthropic, HistoryDigest: "reserialized", ToolsetDigest: "tools"},
|
||||
IssuedCallHash: "issued-cleanup", ResultIDs: []string{"call-cleanup"},
|
||||
}
|
||||
store.mu.Lock()
|
||||
record, matched, err := store.matchRecordLocked("edge-a", "principal-a", "anthropic", lineage)
|
||||
store.mu.Unlock()
|
||||
if err != nil || !matched || record == nil {
|
||||
t.Fatalf("cleanup match: matched=%t record=%v err=%v", matched, record, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHotPathCleanupPrimaryErrorPrecedence(t *testing.T) {
|
||||
for _, endpoint := range []string{"openai", "anthropic"} {
|
||||
endpoint := endpoint
|
||||
|
|
|
|||
|
|
@ -823,6 +823,12 @@ func (s *hotPathLightStore) matchRecordLocked(ownerEdgeID, principalRef, protoco
|
|||
if record.protocol != protocol {
|
||||
return nil, true, fmt.Errorf("%w: protocol changed", errLogicalRequestLineage)
|
||||
}
|
||||
if record.phase == hotPathPhaseCleanupPending && record.pendingKind == hotPathPendingCleanup {
|
||||
if record.lineage.Endpoint != lineage.Prefix.Endpoint || record.lineage.ToolsetDigest != lineage.Prefix.ToolsetDigest {
|
||||
return nil, true, describeArtifactPrefixMismatch(record.lineage, lineage.Prefix)
|
||||
}
|
||||
return record, true, nil
|
||||
}
|
||||
if record.lineage != lineage.Prefix {
|
||||
return nil, true, describeArtifactPrefixMismatch(record.lineage, lineage.Prefix)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue