Repository navigation
Conversation
CRAG 3.0.7 blocks a breakpoint on an assistant block that carries `caller` (CRAG_CACHE_CONTROL 'Caller cache anchor changed in native history'). Claude Code 2.1.325 puts one on the previous tool_use next to the trailing tool_result; the official API accepts it. Drop only that anchor until the kernel accepts it.
CRAG blocks the body before dispatch ('Caller cache anchor changed in native
history'). vm2api saw an empty incomplete hop and replayed it on up to 17 slots,
all of which run the same check. Surface the block as crag_policy_blocked and
classify it as a request-level stop.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73806c3195
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| code: 'crag_policy_blocked', | ||
| message: `Gateway kernel rejected the request before dispatch (${block.code}: ${block.message})`, | ||
| details: { retryable: false }, |
There was a problem hiding this comment.
Preserve the policy-block code through public error mapping
When a CRAG block reaches either the non-streaming response path or the uncommitted streaming path, handle-protocol.mjs passes it through mapProtocolClientError() and mapUpstreamError(). The latter has no case for crag_policy_blocked, so its fallback replaces this code with upstream_error and discards details.retryable: false. Thus API callers receive a generic 502 without the machine-readable indication that this is a deterministic, non-retryable rejection. Add a corresponding public error mapping so the new code and retryability survive beyond the transport helper.
Useful? React with 👍 / 👎.
…RAG print CRAG 3.0.7 rejects a breakpoint on a ToolSearch result (tool_result holding a tool_reference) with CRAG_CACHE_CONTROL "Caller cache anchor changed in native history", same as on a caller-marked assistant block. Replayed the blocked request: 502 as sent, 200 with that breakpoint removed.
|
感谢贡献。替代修复 #1162 已合入 main(1881d65f01)。CRAG 3.1.4 原生保留合法缓存断点;面板仅识别可信、未提交的结构化 CRAG_CACHE_CONTROL 拒绝并停止换槽,不删除合法标记或暴露原始诊断。 此 PR 不再重复合并。 |
Fixes #1120
Problem
Claude Code 2.1.325 places a
cache_controlbreakpoint on the previous assistanttool_useas well as on the trailingtool_result. Thattool_useis a model-emitted block and carriescaller: {type: "direct"}. CRAG 3.0.7 blocks the body locally, before dispatch, with:The official API accepts the same body.
The kernel applies the same block to a breakpoint on a
tool_resultwhose content holds atool_reference(the result of aToolSearchcall). In production since 10:00 UTC on 2026-11-16, all 3 requests whose trailing breakpoint landed on such a result were blocked. None of the other 1,063 CRAG requests were.cache_controlon a block carryingcallerwere blocked. All 320 requests without one passed. Replaying a blocked body with either thecache_controlor thecallerremoved returns 200.502 Assistant hop ended….Fix
crag-print-prompt.mjs:dropNativeBlockCacheAnchorsremovescache_controlonly from assistant blocks that carrycaller. The trailingtool_resultbreakpoint still covers the whole prefix, so caching is unchanged. It also removescache_controlfrom a usertool_resultthat holds atool_reference. That turn then writes no new cache entry; the next turn's trailing breakpoint covers it again. Breakpoints on othertool_resultblocks and on user text are kept. The caller body is not mutated.go-worker-client.mjs: a CRAG result that ispolicy_blockedwith a body-deterministic code (currentlyCRAG_CACHE_CONTROL) comes back as 502crag_policy_blocked, carrying the kernel's code and message, instead of an empty hop.callGoWorker/streamGoWorkerwrap the raw calls for this.upstream-error-policy.mjs:crag_policy_blockedis a request-level stop, so the pool does not replay the same body on other slots.The anchor drop is a workaround until the kernel accepts the breakpoint. The policy-block stop is useful on its own for any future deterministic CRAG block.
Tests
crag-native-anchor.test.mjs: onlycallerblocks andtool_referenceresults losecache_control, other breakpoints are kept, and the input is not mutated.crag-policy-block.test.mjs: the block is surfaced ascrag_policy_blocked, the pool stops without failover, and non-deterministic or committed results pass through unchanged.Verified in production
Running since 2026-11-16 on 1.4.112 with these files mounted. Two originally blocked request bodies replay as 200. The
tool_referencecase went to production at 17:22 UTC. Its blocked body returned 502 before the change and 200 after it, sent unmodified.