Repository navigation
Conversation
已登记归属的加密 agent_message 会话在 Codex 自动压缩(原生 remote compaction v2)时,发送前门禁对所有压缩请求一律返回 encrypted_agent_recovery_route_changed,即使原账号、凭据和路由都没有变, 长会话到达压缩阈值后无法继续。 - 原生 v2 压缩不再因"是压缩"被拒;仍要求回到原 owner,并在真实发送前 复核账号配置、URL、身份头、模型和完整 opaque 项,只容忍网关给压缩 回合补注的 remote_compaction_v2 协商 token(API Key 普通回合没有该头)。 - 压缩仍不登记、不刷新归属;owner 不可用或凭据变化照旧拒绝。 - legacy /responses/compact 和 DeepSeek 压缩转 Chat Completions 仍在契约外。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决的问题与行为变化
agent_message(Codex 多代理),Codex 到自动压缩阈值后发原生 remote compaction v2(裸/responses+stream:true+compaction_trigger)。checkOpenAIAgentRecoveryDispatch对所有压缩请求一律返回 409encrypted_agent_recovery_route_changed,即使 owner 账号、凭据和路由都没变。会话从此压缩不了,也继续不了。线上 v2.20.2 在 9 小时内出现 18 次,涉及 3 个用户(详见 [Bug] 加密代理会话在原通道未变时,Codex 原生压缩仍被 409 route_changed 拒绝,长会话无法继续 #768)。checkOpenAIAgentRecoveryCompaction,复核以下几项:checkOpenAIAgentRecoveryAccount);prepareOpenAIAgentRecoveryAttempt相同);x-codex-beta-features: remote_compaction_v2token。OAuth 普通回合本来就带这个头;API Key 普通回合不带,只有压缩回合带。其他 beta feature、凭据、URL、模型任一变化都返回wire_changed。disallowLearning:不登记、不刷新归属,也不建立交付屏障。/responses/compact仍然拒绝:它会改写 body 和端点,还可能用压缩专用的模型映射。shouldForwardDeepSeekResponsesCompactViaChatCompletions),仍然拒绝。prepareOpenAICompactFallbackRetry)会换模型,因此在 wire 复核时被wire_changed挡住,不会把任务送到别的模型。关联记录与来源
owner_unavailable),本 PR 不处理。production/a010f0846。管理员新功能提示
提示 ID 与
frontend/src/constants/newFeatureNotices.ts登记项(稳定且唯一):不适用,纯后端协议修复,没有管理员可见功能。所有
NewFeatureBadge展示位置:不适用,没有 UI 改动。关闭行为(同一功能多入口共用 ID,点击任一标签后同步隐藏;不同新功能使用不同 ID):不适用,没有新标签。
ID 沿用 / 重新公告说明(普通修复、文案调整、重复发版不换旧 ID;同功能重新通知须明确为新公告登记新 ID):不适用,没有新公告。
同一 PR 的必要回归证据(操作或命令、实际结果、未覆盖情况):不适用,没有管理员新功能。
A 已关闭后升级到 B,B 的新 ID 仍可见;证据或不适用原因:不适用,无管理员新功能。
点击 B 任一入口的标签,相关入口同步隐藏;证据或不适用原因:不适用,无标签。
同一浏览器同一管理员刷新/重新登录后 B 仍隐藏(本地存储可用且未清除);证据或不适用原因:不适用,无本地存储改动。
后续 C 新 ID 正常显示,普通升级不复活 A/B;证据或不适用原因:不适用,无提示 ID 改动。
复现与验收
a010f0846,handler 整链离线测试(沿用 fix: 代理任务无损续接与接入能力一致性(Issue715) #727 的 issue715 假上游,只有账号 1 认得虚构任务引用),全部数据虚构。/v1/responses带 opaqueagent_message,账号 1 完整成功,登记 owner。compaction_trigger)。a010f0846上只放入新测试文件,TestIssue715HTTPNativeCompactionReachesProvenOwner的oauth和apikey子用例都失败,HTTP 409encrypted_agent_recovery_route_changed(与线上错误原文一致)。其余 3 个新测试在修复前后都通过:它们锁定的是本 PR 不该改变的行为。[1, 1];compaction_trigger在 input 最后,出站头含remote_compaction_v2;route_changed,owner 停用仍是owner_unavailable,两者都不向上游发请求;/v1/responses/compact仍是 409route_changed;backend/internal/handler/openai_issue715_compaction_test.go(4 个测试)backend/internal/service/openai_agent_message_recovery_compaction_test.go:只去掉 v2 token;凭据、其他 feature、URL、模型变化都不放行apikey子用例失败(wire_changed),oauth仍通过,说明这一步只对 API Key 账号是必需的。临时改动已还原,不在提交里。协议、调度或传输改动补充(相关时填写)
/responses+stream:true+compaction_trigger,且会话已有 owner 的请求。BPS、Prism、透传、Copilot SDK、SIWC、managed connections、Chat Completions / Anthropic 上游协议仍旧拒绝。encrypted_agent_recovery_*分类。放行后按普通请求计量。DisableStickyEscape不变。压缩回退换模型时被wire_changed挡下,不会换模型重发。实际验证
cd backend && go test -tags=unit ./internal/handler -run 'TestIssue715HTTP(NativeCompaction|LegacyCompact)' -count=1 -v(修复前:productiona010f0846只放入新测试文件)ReachesProvenOwner/oauth、/apikey均expected 200, actual 409,body 为encrypted_agent_recovery_route_changed;其余 3 个测试通过cd backend && go test -tags=unit ./internal/service -run 'TestWithoutOpenAIRemoteCompactionV2Feature|TestOpenAIAgentRecoveryCompactionWire' -count=1 -vcd backend && go test -race -tags=unit ./internal/service ./internal/handler ./internal/repository -run '^Test(Issue715|AstraCodexToolCapabilities|EncryptedSticky|EncryptedPrioritySticky|OpenAIGatewayService_SelectAccountWithScheduler_Encrypted|WithoutOpenAIRemoteCompactionV2Feature|OpenAIAgentRecovery)' -count=1 -timeout=15mcd backend && go test -tags=unit ./internal/service/... ./internal/handler/... -count=1 -timeout=40m(去掉本机代理环境变量)internal/service/data/bps-images/已删除cd backend && go vet -tags=unit ./internal/service ./internal/handlercd backend && GOOS=linux golangci-lint run --path-mode=abs --timeout=30m ./internal/service/... ./internal/handler/...(v2.14.0,Go 1.27.3)GOOS=linux时,macOS 上会报既有的ops_qdisc.gounused(Linux 专用实现),与本 PR 无关gofmt -l(改动文件)、git diff --checkmake -C backend test-integration(含TestGatewayCacheSuite/TestIssue715AgentOwnership真实 Redis)make -C backend test-unitencrypted_agent_recovery_route_changed计数兼容性与运行影响
文档与用户可见变化
不改文档。用户能感受到的变化:用了 Codex 多代理的长会话到了自动压缩阈值,不再卡在
encrypted_agent_recovery_route_changed。Agent 使用声明
提交前自查
🤖 Generated with Claude Code