Skip to content

fix(crag): 外来签名 thinking 导致的 Invalid signature 400 去 thinking 重试 (#1145) - #1149

Merged
dofastted merged 2 commits into
dofastted:mainfrom
panjinhe:fix/crag-foreign-thinking-signature-retry
Nov 17, 2026
Merged

dofastted merged 2 commits into
dofastted:mainfrom
panjinhe:fix/crag-foreign-thinking-signature-retry

Conversation

@panjinhe

Copy link
Copy Markdown
Contributor

Fixes #1145

问题

CRAG 分支从未过滤的 caller body 重建 hopBody(为保留 CRAG 续接指纹),所以别处签发的历史 thinking 原样上送,每轮 400 Invalid signature in thinking block,要客户端自己去 thinking 重试。hop_meta.thinking_owner 却记着 dropped。

改动

  • applyAttempt 的 CRAG print 分支在 meta 里带 foreignThinking(filterThinkingForAccount 算出有 converted/dropped,即本池没签发过的签名)。
  • FailoverRunner:signatureRepair = failover.signature_repair || attemptMeta.foreignThinking。命中签名 400 时走现有 signature_repairable 去 thinking 重试一次(CRAG 分支通过 extra.repairs 在重建后重放修复)。
  • 全局开关语义不变:历史 thinking 都是本池签发的请求(含伪造签名探针),签名 400 照常返回。

验证

  • 新增两个 runner 用例(外来 thinking → 去 thinking 重试 200;无外来 thinking → 仍 400),failover-runner / upstream-error-policy / zero-retry-contract 全过;全量单测失败集合与改动前一致。
  • 生产挂载后,用随机伪造签名的合成请求打 CRAG 槽:第一跳 400 signature_repairable,重试 200。

…ayed foreign thinking

The CRAG branch rebuilds from the unfiltered caller body, so thinking signed
outside this pool reached the provider and failed every turn. When the hop
carried thinking this pool never issued, grade the signature 400 repairable
even with failover.signature_repair off; forged probes on otherwise-own
history still get the 400.

Refs dofastted#1145
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T18:16:32.008453Z cbedd24 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dofastted

Copy link
Copy Markdown
Owner

逐条复核:3.1.4 只覆盖空签名混合历史,不覆盖外来非空签名。converted + dropped 包含归属未知,CRAG 实际回放也未作这次归属过滤;以此自动开启整段 thinking 擦除会误修原生工具续接。需根据已确认外来且定位到的拒绝块做最小修复,并验证已提交/未知/原生续接的反例。暂留开放。

# Conflicts:
#	src/lib/pool/failover-runner.mjs
@dofastted
dofastted merged commit 6a54377 into dofastted:main Nov 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants