fix(edge): Gemini selector 서명 경계를 분리한다

This commit is contained in:
toki 2026-08-15 10:51:38 +09:00
parent bb0b916bf5
commit 48b69740df
2 changed files with 27 additions and 0 deletions

View file

@ -246,6 +246,16 @@ func (s *artifactFrontierStore) expandSelectorPair(
if providerID == "" {
providerID = strings.TrimSpace(call.ID)
}
// The selector stage ends after its atomic pair is expanded into caller
// workspace writes, so its Gemini thought signature is never replayed to
// the selector provider. Keep only the provider's original tool id before
// deriving the two internal write ids; the opaque signature envelope can be
// larger than the logical-request id contract permits.
if decodedID, _, encoded, err := decodeGeminiThoughtSignatureToolID(providerID); err != nil {
return normalizedStageOutput{}, err
} else if encoded {
providerID = decodedID
}
if !validLogicalRequestID(providerID) {
return normalizedStageOutput{}, fmt.Errorf("artifact pair provider tool id is invalid")
}

View file

@ -364,6 +364,23 @@ func TestArtifactSelectorAtomicPairExpandsToCallerWrites(t *testing.T) {
}
}
func TestArtifactSelectorAtomicPairDropsGeminiThoughtSignatureEnvelope(t *testing.T) {
fixture := newArtifactPairFixture(t, "openai", true)
providerID := encodeGeminiThoughtSignatureToolID("provider_pair", strings.Repeat("signature", 64))
output, err := fixture.server.artifactFrontiers.expandSelectorPair(fixture.requestID, fixture.ownerEdgeID, normalizedStageOutput{
ToolCalls: []normalizedToolCall{{
ID: providerID, ProviderCallID: providerID, Name: hotPathArtifactPairToolName,
Arguments: map[string]any{"plan_content": testLightweightPlan(t), "review_content": testPendingReview(t)},
}},
})
if err != nil {
t.Fatal(err)
}
if len(output.ToolCalls) != 2 || output.ToolCalls[0].ProviderCallID != "provider_pair_plan" || output.ToolCalls[1].ProviderCallID != "provider_pair_review" {
t.Fatalf("expanded provider ids=%+v", output.ToolCalls)
}
}
func (f *artifactPairFixture) issuePrepare() []string {
f.t.Helper()
ids, err := f.issue([]normalizedToolCall{{