From 79a0fd4f05f96ba6943488ec0abc9340d7eb0572 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 13:54:13 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=E7=BB=86=E5=88=86=20WS=20=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=89=8D=E5=AE=8C=E6=95=B4=E6=80=A7=E6=8B=92=E7=BB=9D?= =?UTF-8?q?=E7=9A=84=E5=AE=89=E5=85=A8=E8=AF=8A=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/openai_recovery_subreason.go | 3 +- .../service/openai_ws_agent_recovery.go | 10 ++--- .../service/openai_ws_plaintext_owner_test.go | 6 +++ .../service/openai_ws_wire_diagnostics.go | 42 +++++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 backend/internal/service/openai_ws_wire_diagnostics.go diff --git a/backend/internal/service/openai_recovery_subreason.go b/backend/internal/service/openai_recovery_subreason.go index 24b0652947a8..c311b08c04f6 100644 --- a/backend/internal/service/openai_recovery_subreason.go +++ b/backend/internal/service/openai_recovery_subreason.go @@ -11,7 +11,8 @@ func safeOpenAIRecoverySubreason(value string) string { "tool_invalid", "tool_incomplete", "tool_duplicate", "tool_unpaired", "tool_history_unsupported", "shadow_record_changed", "shadow_epoch_changed", "shadow_fence_changed", "shadow_fence_invalid", "shadow_store_unavailable", "input_invalid", "input_integrity", "controls_integrity", "readable_intent_missing", - "http_projection_source", "apikey_projection_source", "oauth_projection_source": + "http_projection_source", "apikey_projection_source", "oauth_projection_source", + "ws_body_unreadable", "ws_readable_source", "ws_projection_integrity", "ws_previous_removed": return value default: return "unknown" diff --git a/backend/internal/service/openai_ws_agent_recovery.go b/backend/internal/service/openai_ws_agent_recovery.go index a3a2487b344c..dba9ba70a868 100644 --- a/backend/internal/service/openai_ws_agent_recovery.go +++ b/backend/internal/service/openai_ws_agent_recovery.go @@ -258,12 +258,12 @@ func (r *openAIWSAgentRecovery) begin(account *Account, source, payload []byte, // bridge payload and accidentally granting a transformed opaque item. reader, err := req.GetBody() if err != nil { - return openAIAgentRecoveryError("wire_changed") + return openAIWSWireRefusal(r.ctx, "ws_body_unreadable", source, payload) } actual, err := io.ReadAll(reader) _ = reader.Close() if err != nil { - return openAIAgentRecoveryError("wire_changed") + return openAIWSWireRefusal(r.ctx, "ws_body_unreadable", source, payload) } payload = actual } @@ -297,7 +297,7 @@ func (r *openAIWSAgentRecovery) begin(account *Account, source, payload []byte, } if r.readable != nil { if openAIAgentRecoveryInputDigest(source) != r.readableSource || openAI409ControlsDigest(source) != r.readableControls { - return openAIAgentRecoveryError("wire_changed") + return openAIWSWireRefusal(ctx, "ws_readable_source", source, payload) } ctx = context.WithValue(ctx, openAIAgentRecoveryContextKey{}, r.readable) if mode == "http_bridge" && account.IsOpenAIApiKey() { @@ -348,7 +348,7 @@ func (r *openAIWSAgentRecovery) begin(account *Account, source, payload []byte, gjson.GetBytes(source, "store").Type != gjson.False || gjson.GetBytes(payload, "previous_response_id").Exists() || proof.sourceInput != openAIAgentRecoveryInputDigest(source) || proof.sourceControls != openAI409ControlsDigest(source) || proof.input != openAIAgentRecoveryInputDigest(payload) || proof.controls != openAI409ControlsDigest(payload) { - return openAIAgentRecoveryError("wire_changed") + return openAIWSWireRefusal(ctx, "ws_projection_integrity", source, payload) } // Recheck the original pointer on the actual selected account before // allowing its HTTP representation to omit that pointer. @@ -374,7 +374,7 @@ func (r *openAIWSAgentRecovery) begin(account *Account, source, payload []byte, } if !projected && !r.request.omittedHistory && previous != "" && (r.request.owner != nil || r.request.disableOwnerBinding || r.request.previousResponseID != "") && gjson.GetBytes(payload, "previous_response_id").String() != previous { - return openAIAgentRecoveryError("wire_changed") + return openAIWSWireRefusal(ctx, "ws_previous_removed", source, payload) } if err := r.service.checkOpenAIAgentRecoveryAccount(ctx, account); err != nil { if r.request.hasCompletedMixedOwners() { diff --git a/backend/internal/service/openai_ws_plaintext_owner_test.go b/backend/internal/service/openai_ws_plaintext_owner_test.go index 91ba3bd8eef7..7b419692b8bd 100644 --- a/backend/internal/service/openai_ws_plaintext_owner_test.go +++ b/backend/internal/service/openai_ws_plaintext_owner_test.go @@ -116,6 +116,12 @@ func TestOpenAIWSPlaintextBridgeProjectionGuards(t *testing.T) { require.Empty(t, manager.request.previousResponseID) } else { require.Error(t, err, "changed projection must never authorize an upstream write") + if change != "owner" && change != "unproven" { + var recovery *OpenAIAgentRecoveryError + require.ErrorAs(t, err, &recovery) + require.Equal(t, "ws_projection_integrity", recovery.InternalSubreason()) + require.Equal(t, "encrypted_agent_recovery_wire_changed", recovery.ClientCode()) + } } }) } diff --git a/backend/internal/service/openai_ws_wire_diagnostics.go b/backend/internal/service/openai_ws_wire_diagnostics.go new file mode 100644 index 000000000000..ae5edd8ecb31 --- /dev/null +++ b/backend/internal/service/openai_ws_wire_diagnostics.go @@ -0,0 +1,42 @@ +package service + +import ( + "context" + + "github.com/tidwall/gjson" + "go.uber.org/zap" +) + +// Fixed field-presence/count metadata only. Never log response IDs, hashes, +// input text, tool content, headers, credentials or arbitrary JSON keys. +func openAIWSWireRefusal(ctx context.Context, stage string, source, payload []byte) error { + sourceInput, wireInput := gjson.GetBytes(source, "input"), gjson.GetBytes(payload, "input") + inputKind := "absent" + switch { + case sourceInput.IsArray(): + inputKind = "array" + case sourceInput.Type == gjson.String: + inputKind = "string" + case sourceInput.Exists(): + inputKind = "other" + } + storeKind := "absent" + switch gjson.GetBytes(source, "store").Type { + case gjson.True: + storeKind = "true" + case gjson.False: + storeKind = "false" + default: + if gjson.GetBytes(source, "store").Exists() { + storeKind = "other" + } + } + return openAIRecoveryWireRefusal(ctx, stage, + zap.String("source_input_kind", inputKind), zap.String("source_store", storeKind), + zap.Int("source_input_items", len(sourceInput.Array())), zap.Int("wire_input_items", len(wireInput.Array())), + zap.Bool("source_previous_present", gjson.GetBytes(source, "previous_response_id").String() != ""), + zap.Bool("wire_previous_present", gjson.GetBytes(payload, "previous_response_id").String() != ""), + zap.Bool("source_model_present", gjson.GetBytes(source, "model").String() != ""), + zap.Bool("input_changed", openAIAgentRecoveryInputDigest(source) != openAIAgentRecoveryInputDigest(payload)), + zap.Bool("controls_changed", openAI409ControlsDigest(source) != openAI409ControlsDigest(payload))) +} From 9327887f34f1fe085bb2d978cca3a915a54fc52c Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 13:55:57 +0800 Subject: [PATCH 2/8] =?UTF-8?q?refactor:=20=E5=B0=86=20WS=20=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E8=AF=8A=E6=96=AD=E4=B8=8E=E5=AF=B9=E5=BA=94=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=A0=A1=E9=AA=8C=E6=94=BE=E5=9C=A8=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/openai_ws_agent_recovery.go | 37 ++++++++++++++++ .../service/openai_ws_wire_diagnostics.go | 42 ------------------- 2 files changed, 37 insertions(+), 42 deletions(-) delete mode 100644 backend/internal/service/openai_ws_wire_diagnostics.go diff --git a/backend/internal/service/openai_ws_agent_recovery.go b/backend/internal/service/openai_ws_agent_recovery.go index dba9ba70a868..a68528173054 100644 --- a/backend/internal/service/openai_ws_agent_recovery.go +++ b/backend/internal/service/openai_ws_agent_recovery.go @@ -11,9 +11,11 @@ import ( "sync/atomic" "time" + "github.com/Wei-Shaw/sub2api/internal/pkg/logger" coderws "github.com/coder/websocket" "github.com/gin-gonic/gin" "github.com/tidwall/gjson" + "go.uber.org/zap" ) type openAIWSAgentRecoveryKey struct{} @@ -561,3 +563,38 @@ func (r *openAIWSAgentRecovery) write(payload []byte, write func() error) error func openAIWSAgentRecoveryClose(err error) error { return NewOpenAIWSClientCloseError(coderws.StatusPolicyViolation, "agent task continuation is unavailable; original task was preserved", err) } + +// Fixed field-presence/count metadata only. Never log response IDs, hashes, +// input text, tool content, headers, credentials or arbitrary JSON keys. +func openAIWSWireRefusal(ctx context.Context, stage string, source, payload []byte) error { + sourceInput, wireInput := gjson.GetBytes(source, "input"), gjson.GetBytes(payload, "input") + inputKind := "absent" + switch { + case sourceInput.IsArray(): + inputKind = "array" + case sourceInput.Type == gjson.String: + inputKind = "string" + case sourceInput.Exists(): + inputKind = "other" + } + storeKind := "absent" + switch gjson.GetBytes(source, "store").Type { + case gjson.True: + storeKind = "true" + case gjson.False: + storeKind = "false" + default: + if gjson.GetBytes(source, "store").Exists() { + storeKind = "other" + } + } + logger.FromContext(ctx).Warn("openai.encrypted_history_409_refused", zap.String("stage", stage), + zap.String("source_input_kind", inputKind), zap.String("source_store", storeKind), + zap.Int("source_input_items", len(sourceInput.Array())), zap.Int("wire_input_items", len(wireInput.Array())), + zap.Bool("source_previous_present", gjson.GetBytes(source, "previous_response_id").String() != ""), + zap.Bool("wire_previous_present", gjson.GetBytes(payload, "previous_response_id").String() != ""), + zap.Bool("source_model_present", gjson.GetBytes(source, "model").String() != ""), + zap.Bool("input_changed", openAIAgentRecoveryInputDigest(source) != openAIAgentRecoveryInputDigest(payload)), + zap.Bool("controls_changed", openAI409ControlsDigest(source) != openAI409ControlsDigest(payload))) + return openAIRecoveryDiagnosticError("wire_changed", stage, openAIAgentRecoveryFromContext(ctx)) +} diff --git a/backend/internal/service/openai_ws_wire_diagnostics.go b/backend/internal/service/openai_ws_wire_diagnostics.go deleted file mode 100644 index ae5edd8ecb31..000000000000 --- a/backend/internal/service/openai_ws_wire_diagnostics.go +++ /dev/null @@ -1,42 +0,0 @@ -package service - -import ( - "context" - - "github.com/tidwall/gjson" - "go.uber.org/zap" -) - -// Fixed field-presence/count metadata only. Never log response IDs, hashes, -// input text, tool content, headers, credentials or arbitrary JSON keys. -func openAIWSWireRefusal(ctx context.Context, stage string, source, payload []byte) error { - sourceInput, wireInput := gjson.GetBytes(source, "input"), gjson.GetBytes(payload, "input") - inputKind := "absent" - switch { - case sourceInput.IsArray(): - inputKind = "array" - case sourceInput.Type == gjson.String: - inputKind = "string" - case sourceInput.Exists(): - inputKind = "other" - } - storeKind := "absent" - switch gjson.GetBytes(source, "store").Type { - case gjson.True: - storeKind = "true" - case gjson.False: - storeKind = "false" - default: - if gjson.GetBytes(source, "store").Exists() { - storeKind = "other" - } - } - return openAIRecoveryWireRefusal(ctx, stage, - zap.String("source_input_kind", inputKind), zap.String("source_store", storeKind), - zap.Int("source_input_items", len(sourceInput.Array())), zap.Int("wire_input_items", len(wireInput.Array())), - zap.Bool("source_previous_present", gjson.GetBytes(source, "previous_response_id").String() != ""), - zap.Bool("wire_previous_present", gjson.GetBytes(payload, "previous_response_id").String() != ""), - zap.Bool("source_model_present", gjson.GetBytes(source, "model").String() != ""), - zap.Bool("input_changed", openAIAgentRecoveryInputDigest(source) != openAIAgentRecoveryInputDigest(payload)), - zap.Bool("controls_changed", openAI409ControlsDigest(source) != openAI409ControlsDigest(payload))) -} From da2b8e8bfe1f9b500918ef5486197d6e8ec8f0ae Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 14:04:57 +0800 Subject: [PATCH 3/8] =?UTF-8?q?ci:=20=E5=9B=BA=E5=AE=9A=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E4=BD=BF=E7=94=A8=20Playwright=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=20Ubuntu=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/encrypted-history-400.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/encrypted-history-400.yml b/.github/workflows/encrypted-history-400.yml index b5491452b136..10283624b576 100644 --- a/.github/workflows/encrypted-history-400.yml +++ b/.github/workflows/encrypted-history-400.yml @@ -43,7 +43,8 @@ jobs: git rev-parse HEAD go test -race -json -p 2 -tags=unit ./internal/service ./internal/handler ./internal/handler/admin -run '^Test(OpenAI400|OpenAI409|OmitOpenAIHistorical|ForwardEncryptedContentSSERetry|UpdateSettingsOpenAI400|UpdateSettingsOpenAI409)' -count=1 -timeout=5m settings: - runs-on: ubuntu-latest + # The pinned Playwright 1.56.1 browser packages support Ubuntu 24.04. + runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - uses: actions/checkout@v6 From a3919d8320b359c9bc364adce3fd5742cccc1a89 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 14:22:59 +0800 Subject: [PATCH 4/8] =?UTF-8?q?ci:=20=E5=9B=BA=E5=AE=9A=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=88=AA=E5=9B=BE=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=20Ubuntu=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/free-fast-customer-cost-details.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/free-fast-customer-cost-details.yml b/.github/workflows/free-fast-customer-cost-details.yml index 21ea6a248eca..abcc058e9f20 100644 --- a/.github/workflows/free-fast-customer-cost-details.yml +++ b/.github/workflows/free-fast-customer-cost-details.yml @@ -118,7 +118,8 @@ jobs: frontend: env: NODE_OPTIONS: --max-old-space-size=4096 - runs-on: ubuntu-latest + # Playwright 1.56.1 has no Chromium package for Ubuntu 26.04. + runs-on: ubuntu-24.04 timeout-minutes: 25 steps: - uses: actions/checkout@v6 From 078e367677168aebc082343c57eae0842320e65b Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 14:58:48 +0800 Subject: [PATCH 5/8] =?UTF-8?q?ci:=20=E9=9A=94=E7=A6=BB=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=20WS=20=E5=8F=8D=E4=BE=8B=E4=B8=AD=E6=99=9A=E4=BA=8E=E5=9F=BA?= =?UTF-8?q?=E7=BA=BF=E7=9A=84=20BPS=20=E6=B5=8B=E8=AF=95=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/prepare-replay-red-fixtures.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/scripts/prepare-replay-red-fixtures.sh b/.github/scripts/prepare-replay-red-fixtures.sh index f5ce3a18a2fb..530825ab431e 100644 --- a/.github/scripts/prepare-replay-red-fixtures.sh +++ b/.github/scripts/prepare-replay-red-fixtures.sh @@ -54,6 +54,14 @@ if ! git -C "$tree" grep -q 'func (a \*Account) IsExcelBPSSearchEnabled' "$basel exit 1 fi exclude_absent_fixture backend/internal/service/openai_excel_bps_search_test.go "$contract" + # PR872 added independent search diagnostics/race fixtures which also use + # that absent API and the excluded search fixture helper. Keep them in every + # candidate GREEN; only isolate proven post-baseline files in this old RED. + for target in backend/internal/service/openai_excel_bps_search_diagnostics_test.go backend/internal/service/openai_excel_bps_search_race_test.go; do + if git -C "$tree" cat-file -e "$candidate:$target" 2>/dev/null; then + exclude_absent_fixture "$target" "$contract" + fi + done fi # Later mixed-owner proofs/diagnostics share the restored recovery struct. From 030e251f5d18e9c026d4e7c56a57bee451362209 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 15:05:34 +0800 Subject: [PATCH 6/8] =?UTF-8?q?ci:=20=E6=81=A2=E5=A4=8D=20HTTP=20=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=8F=8D=E4=BE=8B=E4=B8=AD=E5=B7=B2=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E6=BA=90=E7=A0=81=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/http-task-rebuild.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/http-task-rebuild.yml b/.github/workflows/http-task-rebuild.yml index 909da77756a0..5d351bdde9d9 100644 --- a/.github/workflows/http-task-rebuild.yml +++ b/.github/workflows/http-task-rebuild.yml @@ -96,7 +96,9 @@ jobs: while IFS= read -r target; do case "$target" in *_test.go) continue ;; esac if git cat-file -e "$BASELINE_SHA:$target" 2>/dev/null; then + mkdir -p -- "$(dirname -- "$target")" git show "$BASELINE_SHA:$target" > "$target" + git add -N -- "$target" expected=$(git rev-parse "$BASELINE_SHA:$target") test "$(git hash-object "$target")" = "$expected" echo "$target baseline=$expected" >> "$RUNNER_TEMP/http-task-evidence/red-blobs.txt" @@ -211,7 +213,9 @@ jobs: while IFS= read -r target; do case "$target" in *_test.go) continue ;; esac if git cat-file -e "$REVIEW_BASELINE:$target" 2>/dev/null; then + mkdir -p -- "$(dirname -- "$target")" git show "$REVIEW_BASELINE:$target" > "$target" + git add -N -- "$target" else rm -- "$target" fi From 528d1eb3e1ab253ce36569594689be39ab113f95 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 15:14:59 +0800 Subject: [PATCH 7/8] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8D=20shadow=20?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=BA=90=E7=A0=81=E6=81=A2=E5=A4=8D=E7=9A=84?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=B8=8E=E7=B4=A2=E5=BC=95=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/future-shadow.yml | 2 ++ .github/workflows/shadow-review-repair.yml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/future-shadow.yml b/.github/workflows/future-shadow.yml index a95928ff2a51..d80454597afb 100644 --- a/.github/workflows/future-shadow.yml +++ b/.github/workflows/future-shadow.yml @@ -90,7 +90,9 @@ jobs: while IFS= read -r target; do case "$target" in *_test.go) continue ;; esac if git cat-file -e "$BASELINE_SHA:$target" 2>/dev/null; then + mkdir -p -- "$(dirname -- "$target")" git show "$BASELINE_SHA:$target" > "$target" + git add -N -- "$target" test "$(git hash-object "$target")" = "$(git rev-parse "$BASELINE_SHA:$target")" else rm -- "$target" diff --git a/.github/workflows/shadow-review-repair.yml b/.github/workflows/shadow-review-repair.yml index cfc637b0b53b..38db493e00e2 100644 --- a/.github/workflows/shadow-review-repair.yml +++ b/.github/workflows/shadow-review-repair.yml @@ -81,7 +81,9 @@ jobs: while IFS= read -r target; do case "$target" in *_test.go) continue ;; esac if git cat-file -e "$BASELINE_SHA:$target" 2>/dev/null; then + mkdir -p -- "$(dirname -- "$target")" git show "$BASELINE_SHA:$target" > "$target" + git add -N -- "$target" test "$(git hash-object "$target")" = "$(git rev-parse "$BASELINE_SHA:$target")" else rm -- "$target" @@ -154,7 +156,9 @@ jobs: while IFS= read -r target; do case "$target" in *_test.go) continue ;; esac if git cat-file -e "$baseline:$target" 2>/dev/null; then + mkdir -p -- "$(dirname -- "$tested_tree/$target")" git show "$baseline:$target" > "$tested_tree/$target" + git -C "$tested_tree" add -N -- "$target" test "$(git hash-object "$tested_tree/$target")" = "$(git rev-parse "$baseline:$target")" else rm -- "$tested_tree/$target" From 1166c5ee0aaf7dce16984466c54ac260c8e96617 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Mon, 16 Nov 2026 15:23:35 +0800 Subject: [PATCH 8/8] =?UTF-8?q?ci:=20=E5=AF=B9=E9=BD=90=E6=97=A7=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E5=9F=BA=E7=BA=BF=E4=B8=AD=E7=9A=84=20OAuth=20?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E9=85=8D=E7=BD=AE=E6=B5=8B=E8=AF=95=E5=A5=91?= =?UTF-8?q?=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/prepare-replay-red-fixtures.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/scripts/prepare-replay-red-fixtures.sh b/.github/scripts/prepare-replay-red-fixtures.sh index 530825ab431e..72a45caa89d0 100644 --- a/.github/scripts/prepare-replay-red-fixtures.sh +++ b/.github/scripts/prepare-replay-red-fixtures.sh @@ -67,3 +67,27 @@ fi # Later mixed-owner proofs/diagnostics share the restored recovery struct. script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" bash "$script_dir/prepare-ws-owner-red-fixtures.sh" "$baseline" "$tree" "$candidate" + +# PR874 creation-only OAuth policy is absent in historical recovery sources. +# Keep the selected recovery tests untouched and all candidate GREEN fixtures; +# adapt only these unrelated service fixtures to the exact old Account API. +contract=backend/internal/service/account.go +if ! git -C "$tree" grep -q 'InitialAPIKeyDisposition' "$baseline" -- "$contract"; then + target=backend/internal/service/oauth_apikey_disposition_test.go + if git -C "$tree" cat-file -e "$candidate:$target" 2>/dev/null; then + exclude_absent_fixture "$target" "$contract" + fi + target=backend/internal/service/openai_plugin_account_directory_test.go + expected_contract=$(git -C "$tree" rev-parse "$baseline:$contract") + test "$(git -C "$tree" hash-object "$contract")" = "$expected_contract" + candidate_blob=$(git -C "$tree" rev-parse "$candidate:$target") + test "$(git -C "$tree" hash-object "$target")" = "$candidate_blob" + if git -C "$tree" cat-file -e "$baseline:$target" 2>/dev/null; then + expected=$(git -C "$tree" rev-parse "$baseline:$target") + git -C "$tree" show "$baseline:$target" > "$tree/$target" + test "$(git -C "$tree" hash-object "$target")" = "$expected" + printf 'historical plugin fixture path=%s candidate_blob=%s baseline_blob=%s contract_blob=%s\n' "$target" "$candidate_blob" "$expected" "$expected_contract" + else + exclude_absent_fixture "$target" "$contract" + fi +fi