fix(daemon): guard model context before launch - #5815
Conversation
nettee
left a comment
There was a problem hiding this comment.
The new preflight budgeting path is close, but one supported Claude-family id shape still bypasses the fallback guard when catalog metadata is missing. See the inline note for the concrete matcher gap and the test case I think should be added.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
🧪 Heads-up: this change touches a user-visible run path, so we'll want a manual QA pass before merge. Please hold off merging once the current blocking review is addressed — we'll loop QA in when the PR is otherwise merge-ready. |
Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
|
Looper fixer round complete — cf95984
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
nettee
left a comment
There was a problem hiding this comment.
One reachable Claude model path still bypasses the new preflight guard, so I’m keeping this blocked until that gap is closed.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
|
Looper fixer round complete — 4c9682f
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
nettee
left a comment
There was a problem hiding this comment.
One remaining blocker: the AMR OpenCode enrichment path still drops the new context/output metadata for a reachable class of live catalog entries, so the preflight guard can remain unmeasured for models this PR is supposed to fail fast.
Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
|
Looper fixer round complete — 394cbad
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
nettee
left a comment
There was a problem hiding this comment.
Two blockers remain in the new context-budget path: the rollover compactor can still hand the launch guard an over-budget prompt, and the resume-side rollover check undercounts turns that resend additional instructions. See the inline notes for the concrete paths.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.Budget the exact resumed-turn payload after stable instruction selection, and guarantee transcript tail compaction stays within its token target. Resolve the current main merge conflicts additively across context-budget and retry telemetry. Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
|
Looper fixer round complete — 0723666
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
nettee
left a comment
There was a problem hiding this comment.
One blocker remains in the rollover path: the new transcript compaction target can still be larger than the selected model's safe input budget, so some resumable turns still fail with AGENT_PROMPT_TOO_LARGE instead of reseeding cleanly.
|
Following @nettee's latest review on the current head, the remaining blocker is now pretty focused: the rollover compaction target in the resume path still needs to be derived from the model's real input budget so low-context models reseed cleanly, along with the regression for that case. Once that lands, this can go back through the normal review/QA path. 💡 To drive this PR to merge hands-free, paste this to your AI coding agent (Claude Code / Codex / opencode / Cursor …): |
Account for fresh-session instructions and turn framing before choosing the transcript compaction target, so low-context rollovers can reseed without tripping the launch guard. Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
|
Looper fixer round complete — e47bab4
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
|
Thanks for the focused follow-up here — the rollover fix and the low-context regression are now on the current head ( |
Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
Make the conversation-message boundary explicit so the test observes the loading-disabled state before asserting that question-form submission becomes available. Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
Generated-By: looper 0.11.0 (runner=fixer, agent=codex)
AmyShang-alt
left a comment
There was a problem hiding this comment.
QA Request changes:本地在 PR head 336125d 上验证,daemon context-budget 相关单测 52/52、contracts 5/5、typecheck 通过;但 opencode-session-resume.test.ts 的 rollover 集成用例连续两次失败。第二轮 rollover run 在 10 秒内未进入 succeeded、failed 或 canceled,报 run ... did not finish。这是本 PR 的核心 runtime 路径,当前不能接受合并。请修复 rollover 后 run 不结束的问题,并补充稳定通过的 runtime 验证。
Resolve the run-finished analytics contract by preserving both context-budget and current AMR/OpenCode diagnostics. Give the real daemon/CLI rollover integration a failure budget that does not misclassify slow machines, and retain the last observed run details on timeout. Generated-By: looper 0.11.1 (runner=fixer, agent=codex)
|
Looper fixer round complete — a81037b
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
Generated-By: looper 0.11.1 (runner=fixer, agent=codex)
Generated-By: looper 0.11.1 (runner=fixer, agent=codex)
Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
Preserve resume-state instruction rebuilding while adopting the mainline removal of the Codex image-generation prompt override. Recalibrate the low-context rollover fixture for the current stable-prompt size. Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
Preserve effective input-token analytics from the context-budget branch while adopting mainline batched append-only message event persistence. Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
AmyShang-alt
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. I re-ran the rollover validation on the current head and found one remaining test-harness blocker. Please align the outer Vitest timeout with the run-completion polling budget, then re-run the full file with the default repository command.
Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
|
Looper fixer round complete — 4583df9
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |



































































































Why
The 0.15.0 reliability review found agent runs reaching provider context-window limits only after launch, leaving users with a slow and opaque failure. This PR adds a daemon-side preflight so known model limits fail fast and the decision is observable in both PostHog and Langfuse.
It also preserves context/output limits returned by AMR/OpenCode and provider model catalogs instead of discarding that metadata.
What users will see
Oversized prompts for models with a known context limit now fail before the agent CLI starts, with an actionable
AGENT_PROMPT_TOO_LARGEerror. Models whose limit is not known continue unchanged; the guard is observation-only for them.Surface area
apps/weborapps/desktop(including Electron menu bar)odsubcommand or flag, newtools-dev/tools-pack/tools-prflag, or newOD_*env var/api/*endpoint, new SSE event, or changed shape inpackages/contractsskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolTRANSLATIONS.mdfor the locale workflow)package.json(dependenciesordevDependencies); workspace-packagepackage.jsonfiles are out of scope. Include a paragraph on what we get vs. what bytes we ship (seeCONTRIBUTING.md→ Code style)Screenshots
Not applicable; there is no new UI surface.
Bug fix verification
apps/daemon/tests/runtimes/model-context-budget.test.ts,apps/daemon/tests/runtimes/run-failure-telemetry-smoke.test.ts, andapps/daemon/tests/amr-acp-integration.test.ts.Validation
pnpm typecheckpnpm --filter @open-design/daemon exec vitest run tests/runtimes/model-context-budget.test.ts tests/amr-acp-integration.test.ts tests/langfuse-trace.test.ts(114 passed)pnpm --filter @open-design/contracts exec vitest run tests/analytics-run-finished-contract.test.ts(4 passed)pnpm --filter @open-design/daemon exec vitest run tests/runtimes/run-failure-telemetry-smoke.test.ts(4 passed)pnpm guardreaches the cross-app manifest check and then fails on the current base becauseapps/telemetry-worker/package.jsonis absent; all preceding and subsequent reported checks pass.