refactor(agents): share subagent cron fallback selection#82328
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: not applicable. as a refactor/follow-up PR rather than a standalone bug report. The related bug was already source-proven and fixed by #82302; this diff was checked against the current main fallback path and PR-provided terminal proof. Real behavior proof Next step before merge Security Review detailsBest possible solution: If maintainer review and merge gates pass, land this as a small follow-up that keeps cron primary-model selection and fallback-policy precedence aligned with the already merged fallback fix. Do we have a high-confidence way to reproduce the issue? Not applicable as a refactor/follow-up PR rather than a standalone bug report. The related bug was already source-proven and fixed by #82302; this diff was checked against the current main fallback path and PR-provided terminal proof. Is this the best way to solve the issue? Yes. Sharing a source-aware selection helper is a maintainable way to reduce drift between cron primary model selection and fallback-policy selection, with the remaining merge decision left to maintainers and CI. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against b7e8f6da6ac1. |
Summary
Replaces closed PR #82295. Builds on the #74985 fix already present on main.
Real behavior proof
Behavior addressed: Isolated cron subagent fallback policy now follows the same selected model config as cron subagent primary selection, while payload model overrides keep the default model fallback policy.
Real environment tested: local checkout, importing the real OpenClaw cron fallback resolver through the TS runtime loader after rebase onto origin/main.
Exact steps or command run after this patch: node --import tsx with a cron isolated agentTurn fixture that configures agents.defaults.subagents.model.fallbacks, then the same fixture with payload.model override; node scripts/run-vitest.mjs src/cron/isolated-agent.model-formatting.test.ts src/cron/isolated-agent/model-selection.test.ts src/cron/isolated-agent/run-fallback-policy.test.ts src/cron/isolated-agent/run.payload-fallbacks.test.ts src/agents/agent-scope.test.ts src/agents/pi-embedded-runner/run/failover-policy.test.ts src/agents/pi-embedded-runner/run/fallbacks.test.ts; pnpm exec oxfmt --check --threads=1 src/agents/agent-scope.ts src/agents/agent-scope.test.ts src/cron/isolated-agent.model-formatting.test.ts src/cron/isolated-agent/model-selection.ts src/cron/isolated-agent/run-model-selection.runtime.ts src/cron/isolated-agent/run-fallback-policy.test.ts src/cron/isolated-agent/run.payload-fallbacks.test.ts src/cron/isolated-agent/run.test-harness.ts; git diff --check; codex-review --full-access.
Evidence after fix: Terminal output from the runtime resolver probe:
{ "isolated": [ "openai-codex/gpt-5.4", "zai/glm-5" ], "payloadOverride": [ "openai/gpt-5.4" ] }Focused Vitest passed 7 files / 140 tests after rebase onto origin/main; oxfmt passed; git diff --check passed; codex-review clean after accepted fixups.
Observed result after fix: isolated cron agent turns resolve to the configured subagent fallback chain, payload model overrides use the configured default model fallback policy instead of subagent fallbacks, explicit subagent fallback-only overrides are preserved, and metadata-only subagents.model falls through to the next selected model config.
What was not tested: live Kimi/provider timeout E2E.