diff --git a/.github/scripts/exclude-later-http2-red-fixtures.sh b/.github/scripts/exclude-later-http2-red-fixtures.sh index d6c487651b42..18516bc2f0c5 100644 --- a/.github/scripts/exclude-later-http2-red-fixtures.sh +++ b/.github/scripts/exclude-later-http2-red-fixtures.sh @@ -9,6 +9,7 @@ candidate="${3:-$(git -C "$tree" rev-parse HEAD)}" # The same historical assembly must not retain tests for an absent QQ package. script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" bash "$script_dir/prepare-mature-red-fixtures.sh" "$baseline" "$tree" "$candidate" +bash "$script_dir/prepare-free-fast-red-fixtures.sh" "$baseline" "$tree" "$candidate" # Selective Issue715 overlays retain HTTP2 production/support, so keep its tests. if test -f "$tree/backend/internal/service/http2_gateway_test_support.go"; then exit 0 diff --git a/.github/scripts/http-recovery-native-controls.py b/.github/scripts/http-recovery-native-controls.py new file mode 100644 index 000000000000..49c4d3e36e79 --- /dev/null +++ b/.github/scripts/http-recovery-native-controls.py @@ -0,0 +1,31 @@ +"""Require the same named business failures before the fix and completion after.""" +import importlib.util +import json +from pathlib import Path +import sys + +phase, code, filename = sys.argv[1:] +spec = importlib.util.spec_from_file_location('clean', Path(__file__).with_name('assert-readable-continuation.py')) +clean = importlib.util.module_from_spec(spec) +spec.loader.exec_module(clean) +raw = Path(filename).read_text() +clean.check_clean(raw) +events = [json.loads(line) for line in raw.splitlines() if line.startswith('{')] +root = 'TestOpenAI409NativeControlsContinuation' +leaves = {f'{root}/{account}/stream={stream}/{shape}' + for account in ('oauth', 'apikey') for stream in ('true', 'false') + for shape in ('web_search', 'image_aliases', 'image_bridge', 'image_strip', 'combined')} +terminal = {e['Test']: e['Action'] for e in events + if e.get('Test') and e.get('Action') in ('pass', 'fail', 'skip')} +assert leaves <= terminal.keys(), 'missing named scenarios' +if phase == 'GREEN': + assert int(code) == 0 and all(value == 'pass' for value in terminal.values()), terminal +else: + assert phase == 'RED' and int(code) == 1, (phase, code) + for name in leaves: + expected = 'pass' if '/apikey/' in name and name.endswith('/web_search') else 'fail' + assert terminal[name] == expected, (name, terminal[name], expected) + if expected == 'fail': + output = ''.join(e.get('Output', '') for e in events if e.get('Test') == name) + assert 'HTTP_REBUILD_B_DISPATCH_MISSING' in output and 'encrypted_agent_recovery_wire_changed' in output, name +print(f'{phase}: verified {len(leaves)} named native-control scenarios') diff --git a/.github/scripts/prepare-free-fast-red-fixtures.sh b/.github/scripts/prepare-free-fast-red-fixtures.sh new file mode 100644 index 000000000000..e83bedd86fcc --- /dev/null +++ b/.github/scripts/prepare-free-fast-red-fixtures.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Isolate only the later independent Free Fast service tests when an exact +# historical production overlay lacks their private snapshot implementation. +set -euo pipefail +baseline="$1" +tree="${2:-.}" +candidate="${3:-HEAD}" +if test -f "$tree/backend/internal/service/customer_cost_details.go"; then exit 0; fi +if git -C "$tree" cat-file -e "$baseline:backend/internal/service/customer_cost_details.go" 2>/dev/null; then + echo 'baseline snapshot implementation unexpectedly absent' >&2; exit 1 +fi +contract=backend/internal/service/billing_service.go +test "$(git -C "$tree" hash-object "$contract")" = "$(git -C "$tree" rev-parse "$baseline:$contract")" +target=backend/internal/service/free_fast_customer_cost_test.go +if ! git -C "$tree" cat-file -e "$candidate:$target" 2>/dev/null; then exit 0; fi +if git -C "$tree" cat-file -e "$baseline:$target" 2>/dev/null; then + echo 'refusing to omit a baseline Free Fast fixture' >&2; exit 1 +fi +expected=$(git -C "$tree" rev-parse "$candidate:$target") +if test -f "$tree/$target"; then + test "$(git -C "$tree" hash-object "$target")" = "$expected" + rm -- "$tree/$target" +else + test "$(git -C "$tree" diff --name-only --diff-filter=D "$candidate" -- "$target")" = "$target" +fi +printf 'independent free-fast fixture baseline=%s candidate=%s path=%s blob=%s actual=absent\n' "$baseline" "$candidate" "$target" "$expected" diff --git a/.github/workflows/http-recovery-native-controls.yml b/.github/workflows/http-recovery-native-controls.yml new file mode 100644 index 000000000000..b69310f7846c --- /dev/null +++ b/.github/workflows/http-recovery-native-controls.yml @@ -0,0 +1,72 @@ +name: HTTP recovery native controls +on: + pull_request: + paths: + - 'backend/internal/service/openai*' + - 'backend/internal/handler/openai_409*' + - '.github/workflows/http-recovery-native-controls.yml' + - '.github/scripts/http-recovery-native-controls.py' +permissions: + contents: read +jobs: + behavior: + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + phase: [RED, GREEN] + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - uses: actions/setup-go@v6 + with: + go-version-file: backend/go.mod + cache-dependency-path: backend/go.sum + - name: Install isolated Redis + run: | + bash .github/scripts/ci-ubuntu-mirrors.sh + if ! command -v redis-server >/dev/null; then + sudo apt-get update + sudo apt-get install -y --no-install-recommends redis-server + fi + - name: Restore exact pre-fix production implementation for RED + if: matrix.phase == 'RED' + shell: bash + run: | + set -euo pipefail + baseline=c115bef917eae22fc2f5a4d0ba6ac6cbe600e8e4 + git diff --name-only "$baseline" HEAD -- backend | while IFS= read -r target; do + case "$target" in + *_test.go) continue ;; + *.go) + if git cat-file -e "$baseline:$target" 2>/dev/null; then + git show "$baseline:$target" > "$target" + test "$(git hash-object "$target")" = "$(git rev-parse "$baseline:$target")" + else + rm -- "$target" + fi ;; + esac + done + - name: Authenticated HTTP task continuation + env: + PHASE: ${{ matrix.phase }} + shell: bash + run: | + set -euo pipefail + set +e + (cd backend && go test -race -json -tags=unit,httpprojection ./internal/handler -run '^TestOpenAI409NativeControlsContinuation$' -count=1 -timeout=8m) > "$RUNNER_TEMP/native-controls.jsonl" 2>&1 + result=$? + set -e + python3 .github/scripts/http-recovery-native-controls.py "$PHASE" "$result" "$RUNNER_TEMP/native-controls.jsonl" + - name: Trusted source and late mutation guards + if: matrix.phase == 'GREEN' + working-directory: backend + run: go test -race -tags=unit,httpprojection ./internal/service -run '^TestOpenAI409NativeControlsIntegrity$' -count=1 -v -timeout=3m + - uses: actions/upload-artifact@v7 + if: always() + with: + name: http-native-controls-${{ matrix.phase }}-${{ github.event.pull_request.head.sha }} + path: ${{ runner.temp }}/native-controls.jsonl diff --git a/backend/internal/handler/openai_409_http_rebuild_test.go b/backend/internal/handler/openai_409_http_rebuild_test.go index 2b273f8d2e7b..23fa4f437f8c 100644 --- a/backend/internal/handler/openai_409_http_rebuild_test.go +++ b/backend/internal/handler/openai_409_http_rebuild_test.go @@ -490,6 +490,7 @@ type httpRebuildFixtureOptions struct { accounts func([]service.Account) gateway func(*OpenAIGatewayHandler, []service.Account, service.HTTPUpstream, service.GatewayCache, *service.SettingService, service.UsageLogRepository) settings service.SettingRepository + apiKey func(*service.APIKey) } func runHTTPRebuildFixture(t *testing.T, accountType string, stream bool, pointer, outcome, boundary, mutation string, options ...httpRebuildFixtureOptions) { @@ -630,6 +631,9 @@ func runHTTPRebuildFixture(t *testing.T, accountType string, stream bool, pointe option.gateway(h, accounts, transport, repository.NewGatewayCache(clients()), settings, usage) } template, _ := newIssue715Context(t, "{}") + if option.apiKey != nil { + option.apiKey(template.Keys[string(middleware.ContextKeyAPIKey)].(*service.APIKey)) + } done := make(chan struct{}, 1) var sessions []string pendingBeforeWrite := false diff --git a/backend/internal/handler/openai_409_native_controls_test.go b/backend/internal/handler/openai_409_native_controls_test.go new file mode 100644 index 000000000000..5812c43f7eb9 --- /dev/null +++ b/backend/internal/handler/openai_409_native_controls_test.go @@ -0,0 +1,110 @@ +//go:build unit && httpprojection + +package handler + +import ( + "fmt" + "net/http" + "testing" + + "github.com/Wei-Shaw/sub2api/internal/service" + "github.com/stretchr/testify/require" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +// Real authentication, scheduler, native builders, Redis delivery fences and +// a loopback provider. A emits a patch once, becomes unavailable, then B must +// reuse the result, verify once and finish the same client task. +func TestOpenAI409NativeControlsContinuation(t *testing.T) { + for _, account := range []string{service.AccountTypeOAuth, service.AccountTypeAPIKey} { + for _, stream := range []bool{false, true} { + for _, shape := range []string{"web_search", "image_aliases", "image_bridge", "image_strip", "combined"} { + t.Run(fmt.Sprintf("%s/stream=%t/%s", account, stream, shape), func(t *testing.T) { + search := shape == "web_search" || shape == "combined" + bridge := shape == "image_bridge" || shape == "combined" + explicitImage := shape == "image_aliases" || shape == "image_strip" || shape == "combined" + option := httpRebuildFixtureOptions{ + apiKey: func(key *service.APIKey) { key.Group.AllowImageGeneration = true }, + headers: func(r *http.Request) { + r.Header.Set("User-Agent", "codex_cli_rs/0.110.0") + r.Header.Set("originator", "codex_cli_rs") + }, + accounts: func(accounts []service.Account) { + for i := range accounts { + accounts[i].Extra = map[string]any{"codex_image_generation_bridge": bridge} + if shape == "image_strip" { + accounts[i].Extra["codex_image_generation_explicit_tool_policy"] = "strip" + } + } + }, + request: func(body map[string]any, continuation bool) { + tools := body["tools"].([]any) + if search { + tools = append(tools, map[string]any{"type": "web_search", "external_web_access": false, "search_context_size": "low"}) + } + if explicitImage { + tools = append(tools, map[string]any{"type": "image_generation", "model": "gpt-image-2", "format": "jpeg", "compression": 73, "input_fidelity": "high"}) + } + body["tools"] = tools + }, + toolsAvailable: func(body []byte) bool { + // The provider validates the original executable function + // declarations separately from hosted compatibility tools. + tools := gjson.GetBytes(body, "tools").Array() + for i := len(tools) - 1; i >= 2; i-- { + kind := tools[i].Get("type").String() + if kind != "web_search" && kind != "image_generation" { + return false + } + var err error + body, err = sjson.DeleteBytes(body, fmt.Sprintf("tools.%d", i)) + if err != nil { + return false + } + } + return httpRebuildToolsAvailable(body) + }, + provider: func(t *testing.T, body []byte, _ http.Header, n int) { + searchTool := gjson.GetBytes(body, `tools.#(type==web_search)`) + require.Equal(t, search, searchTool.Exists()) + if search { + require.Equal(t, "low", searchTool.Get("search_context_size").String()) + require.Equal(t, account == service.AccountTypeAPIKey, searchTool.Get("external_web_access").Exists()) + if account == service.AccountTypeAPIKey { + require.Equal(t, gjson.False, searchTool.Get("external_web_access").Type) + } + } + imageTool := gjson.GetBytes(body, `tools.#(type==image_generation)`) + wantImage := (explicitImage || bridge) && shape != "image_strip" + require.Equal(t, wantImage, imageTool.Exists()) + wantTools := 2 + if search { + wantTools++ + } + if wantImage { + wantTools++ + } + require.Len(t, gjson.GetBytes(body, "tools").Array(), wantTools) + if wantImage && explicitImage { + require.Equal(t, "jpeg", imageTool.Get("output_format").String()) + require.Equal(t, int64(73), imageTool.Get("output_compression").Int()) + for _, field := range []string{"format", "compression", "input_fidelity"} { + require.False(t, imageTool.Get(field).Exists()) + } + } + if bridge { + require.Equal(t, "auto", gjson.GetBytes(body, "tool_choice").String()) + require.NotEmpty(t, gjson.GetBytes(body, "instructions").String()) + } + if n > 1 { + require.NotContains(t, string(body), "fixture-opaque-A") + } + }, + } + runHTTPRebuildFixture(t, account, stream, "previous", "completed", "issue854_auth", "", option) + }) + } + } + } +} diff --git a/backend/internal/service/openai_409_native_controls.go b/backend/internal/service/openai_409_native_controls.go new file mode 100644 index 000000000000..38eb03fb2388 --- /dev/null +++ b/backend/internal/service/openai_409_native_controls.go @@ -0,0 +1,65 @@ +package service + +import ( + "context" + "encoding/json" + + "github.com/Wei-Shaw/sub2api/internal/pkg/openai" + "github.com/gin-gonic/gin" + "github.com/tidwall/gjson" +) + +// projectOpenAI409ImageControls applies the native builder's explicit image +// policy to a verified readable source BEFORE freezing its representation. +// It never accepts the builder's final body as a new trusted snapshot. The +// ordinary builder still checks permission/model validity and applies these +// idempotent transforms; any other late task or controls mutation is refused. +func (s *OpenAIGatewayService) projectOpenAI409ImageControls(ctx context.Context, c *gin.Context, account *Account, body []byte) ([]byte, error) { + isCodexCLI := openai.IsCodexOfficialClientByHeaders(c.GetHeader("User-Agent"), c.GetHeader("originator")) || + (s.cfg != nil && s.cfg.Gateway.ForceCodexCLI) + strip := isCodexCLI && account.CodexImageGenerationExplicitToolPolicy() == codexImageGenerationExplicitToolPolicyStrip + apiKey := getAPIKeyFromContext(c) + allowed := GroupAllowsImageGenerationLatest(c.Request.Context(), apiKeyGroup(apiKey)) + bridge := isCodexCLI && !isOpenAIResponsesLiteHeader(c.GetHeader(responsesLiteHeader)) && + allowed && !strip && s.isCodexImageGenerationBridgeEnabled(ctx, account, apiKey) + requestedModel := gjson.GetBytes(body, "model").String() + _, upstreamModel := resolveOpenAIForwardMappedModels(account, requestedModel, false) + normalize := allowed && (bridge || isOpenAIImageGenerationModel(requestedModel) || + openAIRequestBodyImageGenerationToolNeedsNormalization(body) || isOpenAIImageGenerationModel(upstreamModel)) + spark := isCodexSparkModel(upstreamModel) && openAIRequestBodyHasImageGenerationDeclaration(body) + if !strip && !normalize && !spark { + return body, nil + } + var decoded map[string]any + if err := decodeOpenAIJSONUseNumber(body, &decoded); err != nil { + return nil, err + } + // Model routing is independent of input/controls. Evaluate the same target + // model as Forward, then retain the caller's model for normal routing and + // billing; projecting a tool cannot silently select a different account. + originalModel, hadModel := decoded["model"] + decoded["model"] = upstreamModel + if strip { + stripOpenAIImageGenerationTools(decoded) + } + if normalize { + if bridge { + ensureOpenAIResponsesImageGenerationTool(decoded) + ensureOpenAIResponsesImageGenerationToolChoiceAuto(decoded) + } + normalizeOpenAIResponsesImageGenerationTools(decoded) + normalizeOpenAIResponsesImageOnlyModel(decoded) + if bridge { + applyCodexImageGenerationBridgeInstructions(decoded) + } + } + if spark { + stripCodexSparkImageGenerationTools(decoded) + } + if hadModel { + decoded["model"] = originalModel + } else { + delete(decoded, "model") + } + return json.Marshal(decoded) +} diff --git a/backend/internal/service/openai_409_native_controls_test.go b/backend/internal/service/openai_409_native_controls_test.go new file mode 100644 index 000000000000..831b9d460573 --- /dev/null +++ b/backend/internal/service/openai_409_native_controls_test.go @@ -0,0 +1,65 @@ +//go:build unit && httpprojection + +package service + +import ( + "context" + "encoding/json" + "testing" + + "github.com/Wei-Shaw/sub2api/internal/config" + "github.com/stretchr/testify/require" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +func TestOpenAI409NativeControlsIntegrity(t *testing.T) { + for _, mutation := range []string{"none", "task_before", "schema_before", "task_after", "schema_after", "instructions_after", "tool_output_after"} { + t.Run(mutation, func(t *testing.T) { + body := []byte(`{"model":"gpt-5.1","instructions":"reuse exactly once","input":[{"role":"user","content":"verify the completed patch"},{"type":"function_call","name":"verify","call_id":"call_1","arguments":"{\"value\":9007199254740993}"},{"type":"function_call_output","call_id":"call_1","output":"completed once"}],"tools":[{"type":"function","name":"verify","parameters":{"type":"object","properties":{"value":{"type":"integer"}}}},{"type":"web_search","external_web_access":false}]}`) + r := &openAIAgentRecoveryRequest{omittedHistory: true, inputDigest: openAIAgentRecoveryInputDigest(body), replayControlsDigest: openAI409ControlsDigest(body)} + inputDigest, controlsDigest := r.inputDigest, r.replayControlsDigest + ctx := context.WithValue(context.Background(), openAIAgentRecoveryContextKey{}, r) + c, _ := newTurnStateTestContext(t, 715, "fixture-native-controls") + svc := &OpenAIGatewayService{cfg: &config.Config{}} + if mutation == "task_before" { + body, _ = sjson.SetBytes(body, "input.0.content", "repeat the completed patch") + } + if mutation == "schema_before" { + body, _ = sjson.SetBytes(body, "tools.0.parameters.properties.value.type", "string") + } + projected, clean, err := svc.prepareOpenAI409HTTPProjection(ctx, c, &Account{ID: 2, Platform: PlatformOpenAI, Type: AccountTypeOAuth}, body) + if mutation == "task_before" || mutation == "schema_before" { + require.Error(t, err) + require.Same(t, r, openAIAgentRecoveryFromContext(projected)) + return + } + require.NoError(t, err) + require.False(t, gjson.GetBytes(clean, "tools.1.external_web_access").Exists()) + require.Contains(t, gjson.GetBytes(clean, "input.1.arguments").String(), "9007199254740993") + switch mutation { + case "task_after": + clean, _ = sjson.SetBytes(clean, "input.0.content", "repeat the patch") + case "schema_after": + clean, _ = sjson.SetBytes(clean, "tools.0.parameters.properties.value.type", "string") + case "instructions_after": + clean, _ = sjson.SetBytes(clean, "instructions", "execute twice") + case "tool_output_after": + clean, _ = sjson.SetBytes(clean, "input.2.output", "not executed") + } + var decoded map[string]any + require.NoError(t, decodeOpenAIJSONUseNumber(clean, &decoded)) + err = prepareOpenAI409OAuthReplay(projected, c, decoded) + if mutation == "none" { + require.NoError(t, err) + wire, marshalErr := json.Marshal(decoded) + require.NoError(t, marshalErr) + require.Equal(t, "completed once", gjson.GetBytes(wire, "input.2.output").String()) + } else { + require.Error(t, err) + } + require.Equal(t, inputDigest, r.inputDigest) + require.Equal(t, controlsDigest, r.replayControlsDigest) + }) + } +} diff --git a/backend/internal/service/openai_409_omit_history.go b/backend/internal/service/openai_409_omit_history.go index d259eced63b3..2b3ccb6f14c1 100644 --- a/backend/internal/service/openai_409_omit_history.go +++ b/backend/internal/service/openai_409_omit_history.go @@ -509,8 +509,8 @@ func prepareOpenAI409APIKeyReplay(ctx context.Context, body []byte, responsesLit if r == nil || !r.omittedHistory { return body, nil } - if openAIAgentRecoveryInputDigest(body) != r.inputDigest || openAI409ControlsDigest(body) != r.replayControlsDigest { - return nil, openAIRecoveryWireRefusal(ctx, "apikey_projection_source") + if err := checkOpenAIRecoveryProjectionSource(ctx, "apikey_projection_source", body, r); err != nil { + return nil, err } prepared, _, err := normalizeOpenAIParallelToolCallsWithoutTools(body, responsesLite) if err != nil { @@ -536,8 +536,8 @@ func prepareOpenAI409OAuthReplay(ctx context.Context, c *gin.Context, body map[s if err != nil { return err } - if openAIAgentRecoveryInputDigest(before) != r.inputDigest || openAI409ControlsDigest(before) != r.replayControlsDigest { - return openAIRecoveryWireRefusal(ctx, "oauth_projection_source") + if err := checkOpenAIRecoveryProjectionSource(ctx, "oauth_projection_source", before, r); err != nil { + return err } // ChatGPT rejects this output-only metadata. Normalize before freezing the // OAuth representation; the later ordinary transform must be idempotent. @@ -581,6 +581,18 @@ func openAIRecoveryWireRefusal(ctx context.Context, stage string) error { return openAIAgentRecoveryError("wire_changed") } +func checkOpenAIRecoveryProjectionSource(ctx context.Context, stage string, body []byte, r *openAIAgentRecoveryRequest) error { + inputChanged := openAIAgentRecoveryInputDigest(body) != r.inputDigest + controlsChanged := openAI409ControlsDigest(body) != r.replayControlsDigest + if !inputChanged && !controlsChanged { + return nil + } + // Fixed metadata only. Do not log the input, tools, instructions or digests. + logger.FromContext(ctx).Warn("openai.encrypted_history_409_refused", zap.String("stage", stage), + zap.Bool("input_changed", inputChanged), zap.Bool("controls_changed", controlsChanged)) + return openAIAgentRecoveryError("wire_changed") +} + // Derive the HTTP representation only from the verified readable snapshot, // before Forward's compatibility pipeline touches it. Keep the original // context immutable so a later account admission starts from the same input. @@ -590,11 +602,17 @@ func (s *OpenAIGatewayService) prepareOpenAI409HTTPProjection(ctx context.Contex if r == nil || !r.omittedHistory { return ctx, body, nil } - if openAIAgentRecoveryInputDigest(body) != r.inputDigest || openAI409ControlsDigest(body) != r.replayControlsDigest { - return ctx, body, openAIRecoveryWireRefusal(ctx, "http_projection_source") + if err := checkOpenAIRecoveryProjectionSource(ctx, "http_projection_source", body, r); err != nil { + return ctx, body, err } clean := s.normalizeRequestTimezone(ctx, account, body, "http") var err error + if account.IsOpenAIOAuthLike() { + clean, _, err = stripOpenAICodexUnsupportedWebSearchFields(clean) + if err != nil { + return ctx, body, err + } + } clean, _, err = normalizeOpenAIResponsesLegacyIngressWithConfig(s.cfg, clean) if err != nil { return ctx, body, err @@ -628,6 +646,10 @@ func (s *OpenAIGatewayService) prepareOpenAI409HTTPProjection(ctx context.Contex } } } + clean, err = s.projectOpenAI409ImageControls(ctx, c, account, clean) + if err != nil { + return ctx, body, err + } snapshot := *r snapshot.inputDigest = openAIAgentRecoveryInputDigest(clean) snapshot.replayControlsDigest = openAI409ControlsDigest(clean) diff --git a/docs/encrypted-history-409-beta.md b/docs/encrypted-history-409-beta.md index 0ec8d1de6cfe..74e9006b7504 100644 --- a/docs/encrypted-history-409-beta.md +++ b/docs/encrypted-history-409-beta.md @@ -42,6 +42,8 @@ HTTP 重建请求会在原始可读快照验证通过后,按目标账号执行 API Key 账号开启普通透传时,重建请求使用原生 Responses 构造与交付流程;普通请求仍使用透传。其他尚不支持重建的账号路线在选号时排除,避免先选中再本地拒绝。WS 新连接首帧没有会话指针、但已有可读任务和原 owner 时,初次选号发现 owner 不可用也会进入一次有界重建。 +HTTP 投影也在冻结前执行目标 OAuth 的搜索字段清理,以及当前权限和账号策略允许的生图工具参数规范化、桥接或剥离。后续原生构造重复执行这些转换时应保持幂等;可读任务、工具参数与已完成结果仍受保护。源快照不匹配时,拒绝日志增加 `input_changed` / `controls_changed` 布尔值,以区分内容和工具控制字段,不记录内容或摘要。该修复不会自动放开 owner 冲突或不确定交付。 + 重建或显式完整历史保护请求的正文在物理发送前不再按自动出口时区改写,以免验证后更改用户任务;HTTP 时区请求头仍可按出口更新,普通请求的自动时区行为不变。手动时区在 HTTP 重建投影中处理。缺少可读任务、未完成工具或交付不确定时继续停止,不以重新计算最终摘要掩盖变化。