fix(openai): cleanup receipt를 exact call id로 수렴시킨다
This commit is contained in:
parent
a676e35905
commit
a10790b8f2
3 changed files with 17 additions and 9 deletions
|
|
@ -343,8 +343,7 @@ func (c *logicalRequestCoordinator) commitCleanupByLineage(
|
|||
if target == nil {
|
||||
return logicalRequestSnapshot{}, errLogicalRequestNotFound
|
||||
}
|
||||
if target.lineage.Endpoint != lineage.Prefix.Endpoint || target.lineage.ToolsetDigest != lineage.Prefix.ToolsetDigest ||
|
||||
target.expectedIssuedCallHash != lineage.IssuedCallHash {
|
||||
if target.lineage.Endpoint != lineage.Prefix.Endpoint || target.lineage.ToolsetDigest != lineage.Prefix.ToolsetDigest {
|
||||
return logicalRequestSnapshot{}, errLogicalRequestLineage
|
||||
}
|
||||
snapshot := target.snapshot()
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ func TestHotPathCleanupMatchIgnoresCallerHistoryReserialization(t *testing.T) {
|
|||
}
|
||||
lineage := logicalRequestContinuationLineage{
|
||||
Prefix: logicalRequestLineage{Endpoint: logicalRequestEndpointAnthropic, HistoryDigest: "reserialized", ToolsetDigest: "tools"},
|
||||
IssuedCallHash: "issued-cleanup", ResultIDs: []string{"call-cleanup"},
|
||||
IssuedCallHash: "sdk-reserialized-cleanup", ResultIDs: []string{"call-cleanup"},
|
||||
}
|
||||
store.mu.Lock()
|
||||
record, matched, err := store.matchRecordLocked("edge-a", "principal-a", "anthropic", lineage)
|
||||
|
|
|
|||
|
|
@ -810,6 +810,21 @@ func (s *hotPathLightStore) matchRecordLocked(ownerEdgeID, principalRef, protoco
|
|||
return nil, true, fmt.Errorf("light tool frontier replay rejected")
|
||||
}
|
||||
}
|
||||
for _, record := range candidates {
|
||||
if record.phase != hotPathPhaseCleanupPending || record.pendingKind != hotPathPendingCleanup || !hotPathPendingIDsIntersect(record, lineage.ResultIDs) {
|
||||
continue
|
||||
}
|
||||
if record.ownerEdgeID != ownerEdgeID {
|
||||
return nil, true, errLogicalRequestOwnerMismatch
|
||||
}
|
||||
if record.principalRef != principalRef {
|
||||
return nil, true, errLogicalRequestPrincipal
|
||||
}
|
||||
if record.protocol != protocol || record.lineage.Endpoint != lineage.Prefix.Endpoint || record.lineage.ToolsetDigest != lineage.Prefix.ToolsetDigest {
|
||||
return nil, true, errLogicalRequestLineage
|
||||
}
|
||||
return record, true, nil
|
||||
}
|
||||
for _, record := range candidates {
|
||||
if record.pendingHash != lineage.IssuedCallHash {
|
||||
continue
|
||||
|
|
@ -823,12 +838,6 @@ 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