fix(codex): pass verified context window to thread config - #3488
fix(codex): pass verified context window to thread config#3488junshanxu wants to merge 22 commits into
Conversation
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/agents/codex/index.ts | Resolves the verified route context window at thread-config assembly time and conditionally forwards only positive integers. |
| packages/maker-core/src/agents/codex/index.test.ts | Covers new threads, resumed threads, unverified metadata, and stale-daemon recovery following a model switch. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Selected provider and catalog model] --> B[Resolve verified context window]
B --> C{Positive integer?}
C -->|Yes| D[Add model_context_window to thread config]
C -->|No| E[Omit override]
D --> F[Start or resume Codex thread]
E --> F
Reviews (1): Last reviewed commit: "fix(codex): pass verified context window..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e10ee114a
ℹ️ 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".
|
@yuaiccc 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
MagicLizi
left a comment
There was a problem hiding this comment.
格式门未通过:PR 描述缺仓库模板要求的段落「这次改了什么 / 怎么验证的 / 风险」。
当前描述用了 Summary / Scope / Testing,请改写成模板中的三段(可以把现有内容搬进去),补全后再请求审查。
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 000153bda2
ℹ️ 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".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5691eb535d
ℹ️ 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".
|
@yuaiccc 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41fd0ec76d
ℹ️ 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".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce6ae79ba8
ℹ️ 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".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98d3349eb8
ℹ️ 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".
|
@yuaiccc 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
这些问题已在当前 head 的后续 commit 中修复(格式门/安全门已通过),自动 dismiss 旧的 CHANGES_REQUESTED 以解除合并阻塞。
|
这个 PR 命中了维护者确认门(架构:Codex 核心路径约 1375 行)。合并前需要维护者在本 PR 上 Approve。 讨论 issue:#3536 请维护者直接在 PR 上 Approve 放行;若要修改请 Request Changes。作者侧目前还有未 resolve 的 review conversation,请一并处理。 |
|
@yuaiccc 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61dd7c7328
ℹ️ 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".
|
@yuaiccc 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70afd1355e
ℹ️ 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".
|
@yuaiccc 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
Addressed the latest Codex P2 in 0d835b0. The turn now keeps the permission mode frozen at send time, but after asynchronous Skill input preparation and model-route stabilization it refreshes approvalsReviewer from the stable route when the permission mode is unchanged. This prevents both new-route + stale auto_review and new-route + stale user combinations while preserving permission-tightening interrupt semantics. Regression coverage exercises both openai → xd and xd → openai route switches during asynchronous input preparation. Verified locally:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d835b01b5
ℹ️ 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".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
Addressed the latest policy-turn P1 in dfbe82e. The post-input stabilization step now evaluates policy-turn unattended launch state from the permission mode frozen before asynchronous input preparation, so an Auto → Ask tightening cannot clear the pending interrupt that setPermissionMode just armed. Added a regression that holds Skill expansion, tightens a policy turn from Auto to Ask, then verifies the frozen untrusted/read-only turn starts and is interrupted as soon as its id arrives. Verified locally:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfbe82ebc2
ℹ️ 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".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
Addressed the reverse policy-transition P1 in 3fdf7a9. A policy turn is now tracked as unattended when either its send-time permission snapshot was Auto or the stabilized pre-start permission mode is Auto. This preserves the pending interrupt for Auto → Ask during Skill expansion and also records Ask → Auto before launch so a later Auto → Ask tightening interrupts the live turn. Added the reverse Ask → Auto → launch → Ask regression alongside the existing Auto → Ask pending-input case. Verified locally:
|
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d5d1711d8
ℹ️ 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".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b3429838c
ℹ️ 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".
|
@junshanxu 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/codex/index.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
这次改了什么
为 Codex 线程配置补上已核实的路由上下文窗口,避免
gpt-5默认哨兵在首次启动或冷恢复时沿用错误的基础窗口。thread/start/ 冷thread/resume前,通过同一 app-server 的model/list解析 concrete default model,再生成model_context_window。thread/resume,在首个 turn 前补上线程级配置。怎么验证的
pnpm --filter @cindy/maker-core exec vitest run src/agents/codex/index.test.ts:588 passed。pnpm test:unit:related:Desktop、lizi-mcps、maker-core、orca-workflow 全部通过。pnpm --filter @cindy/maker-core run --if-present typecheck:maker-core 无独立typecheckscript,按门禁跳过。pnpm check:dco:通过(20 commits signed off)。git diff --check:通过。运行时指标实测(2026-08-27)
可能受影响的指标是:(1)
gpt-5哨兵会话启动延迟;(2) stale-daemon / 模型切换时的thread/resume → turn/start事件顺序;(3) turn 的模型归属与contextWindow返回准确性。未修改 translator、token/event 热路径或 prompt/tool 内容。codex-cli 0.146.0启动独立 stdio app-server,仅执行initialize后串行调用 10 次model/list(不创建 thread、不发模型请求)。initialize为 476.7ms;首个model/list为 1078.5ms;10 次总体 p50 为 1.0ms,p95/最大为 1078.5ms;返回 6 个可见条目并成功找到默认模型。结论:冷启动哨兵路径的主要增量是一次真实model/listRTT;暖 host 后该 RPC 命中 app-server 缓存,实测约 1ms。具体模型路径不调用model/list,没有这次网络往返。startSession → close。具体模型路径 p50/p95 为 0.038/0.102ms,gpt-5哨兵解析路径为 0.039/0.104ms,客户端增量约 0.001/0.002ms。结论:新增解析和 config 组装本身没有形成可见热路径开销。thread/start,不会按页叠加 20s 等待。model/list → thread/start(model + model_context_window) → turn/start。stale-daemon 竞态实测顺序为首个turn/start返回thread not found→thread/resume(model=new-model, model_context_window=900000)→ 重试turn/start(model=new-model);turn 完成后没有冗余 resume。getUsageSnapshot().contextWindow实测收敛为新路由的 900,000;gpt-5哨兵恢复用例收敛为目录核实值 372,000。588 个 Codex 用例同时覆盖事件顺序、权限 profile、模型/provider 切换、失败重试和 usage 归属。风险
仅影响 CodexAgent 的新建、冷恢复、模型/provider 切换及 stale-daemon 恢复线程配置,不涉及 UI、数据库、协议 schema、凭证或用户数据迁移。
model/list失败或达到 20s 总 deadline 时保留 sentinel 回退;恢复响应确认 concrete model 后才补偿应用线程窗口。补偿请求失败时按会话启动/重试失败处理,避免带着错误窗口继续执行。回退本 PR 即恢复原有 Codex 默认窗口行为。