Skip to content

refactor(agents): share subagent cron fallback selection#82328

Merged
steipete merged 5 commits into
mainfrom
fix/subagent-fallback-policy-74985-land
May 15, 2026
Merged

refactor(agents): share subagent cron fallback selection#82328
steipete merged 5 commits into
mainfrom
fix/subagent-fallback-policy-74985-land

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Refactor isolated cron subagent model selection so the primary model and fallback policy use one shared precedence helper.
  • Preserve subagent-specific fallback overrides, including fallback-only configs, without letting parent agent fallback policy shadow selected subagent defaults.
  • Add regression coverage for metadata-only fallthrough, fallback-only overrides, and payload model override precedence.

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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR shares subagent cron model-selection precedence through an agent-scope helper and expands fallback-policy regression coverage for metadata-only, fallback-only, and payload override cases.

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
Sufficient (terminal): The PR body includes after-fix terminal output from a real TS runtime resolver probe plus focused test and formatting commands; it does not claim live provider timeout E2E coverage.

Next step before merge
No ClawSweeper repair lane is needed; there are no blocking review findings and the remaining action is normal protected-label maintainer merge handling.

Security
Cleared: The diff is limited to TypeScript agent/cron fallback plumbing and tests, with no dependency, CI, secret-handling, package, or supply-chain surface changed.

Review details

Best 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:

  • steipete: Authored the current-main subagent cron fallback fix and has adjacent history on cron fallback preservation and isolated cron execution seams. (role: recent fallback and cron area contributor; confidence: high; commits: e22a7e45a40a, ff2b2e769f5d, 91d20781ed03; files: src/agents/agent-scope.ts, src/cron/isolated-agent/run-fallback-policy.ts, src/cron/isolated-agent/run-executor.ts)
  • vincentkoc: Recent commit history shows work isolating cron runtime-heavy seams and agent-scope config helpers near the touched selection and fallback surfaces. (role: recent cron and agent-scope refactor contributor; confidence: medium; commits: 35176f3cb730, a372e4a15240; files: src/cron/isolated-agent/model-selection.ts, src/cron/isolated-agent/run-model-selection.runtime.ts, src/agents/agent-scope-config.ts)
  • neeravmakwana: Authored adjacent subagent model precedence work that touched the broader model-selection surface used by this PR. (role: subagent model precedence contributor; confidence: medium; commits: e394262bd87e; files: src/agents/model-selection.ts, src/cron/isolated-agent/model-selection.ts)
  • obviyus: Committed the adjacent subagent model precedence change, making them a routing candidate if maintainers need context on that behavior contract. (role: committer for adjacent precedence work; confidence: low; commits: e394262bd87e; files: src/agents/model-selection.ts, src/cron/isolated-agent/model-selection.ts)

Remaining risk / open question:

  • No live Kimi/provider timeout E2E was inspected; the PR body also lists that as not tested, so final merge should rely on focused resolver proof unless maintainers require live-provider validation.

Codex review notes: model gpt-5.5, reasoning high; reviewed against b7e8f6da6ac1.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 15, 2026
@steipete steipete merged commit 0ad3d25 into main May 15, 2026
98 of 103 checks passed
@steipete steipete deleted the fix/subagent-fallback-policy-74985-land branch May 15, 2026 21:36
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
)

* fix(agents): honor subagent cron fallbacks

* refactor(agents): share cron subagent model selection

* test(agents): align subagent fallback policy expectation

* fix(agents): keep subagent fallbacks on selected model

* fix(agents): preserve subagent fallback-only overrides
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
)

* fix(agents): honor subagent cron fallbacks

* refactor(agents): share cron subagent model selection

* test(agents): align subagent fallback policy expectation

* fix(agents): keep subagent fallbacks on selected model

* fix(agents): preserve subagent fallback-only overrides
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
)

* fix(agents): honor subagent cron fallbacks

* refactor(agents): share cron subagent model selection

* test(agents): align subagent fallback policy expectation

* fix(agents): keep subagent fallbacks on selected model

* fix(agents): preserve subagent fallback-only overrides
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
)

* fix(agents): honor subagent cron fallbacks

* refactor(agents): share cron subagent model selection

* test(agents): align subagent fallback policy expectation

* fix(agents): keep subagent fallbacks on selected model

* fix(agents): preserve subagent fallback-only overrides
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant