Repository navigation
2026-87: feat(spawn): block opencode dispatch on unhealthy free-model entry - #87
Merged
Merged
Conversation
… entry Checks the project's weekly-scanned opencode-free-models.json (IMAC AutomationSync knowledge, falling back to data/) after the existing models.dev zero-cost check, so a model that is still listed and free but already flagged early_termination_detected or non-active is caught before dispatch instead of mid-task. A missing or non-matching catalog warns and proceeds, since it is a secondary enrichment signal.
… gate and dual-path lookup
…e fallback, and support catalog override
Ivory2024
added a commit
that referenced
this pull request
Oct 7, 2026
… entry (#87) * feat(spawn): refuse opencode dispatch on unhealthy free-model catalog entry Checks the project's weekly-scanned opencode-free-models.json (IMAC AutomationSync knowledge, falling back to data/) after the existing models.dev zero-cost check, so a model that is still listed and free but already flagged early_termination_detected or non-active is caught before dispatch instead of mid-task. A missing or non-matching catalog warns and proceeds, since it is a secondary enrichment signal. * no-mistakes(review): docs: document mechanical fm-spawn.sh free-model gate and dual-path lookup * no-mistakes(document): docs: sync opencode harness ref with new health-catalog gate * fix(spawn): fix opencode mini detection regex, keep legacy interactive fallback, and support catalog override
Ivory2024
added a commit
that referenced
this pull request
Oct 7, 2026
… entry (#87) * feat(spawn): refuse opencode dispatch on unhealthy free-model catalog entry Checks the project's weekly-scanned opencode-free-models.json (IMAC AutomationSync knowledge, falling back to data/) after the existing models.dev zero-cost check, so a model that is still listed and free but already flagged early_termination_detected or non-active is caught before dispatch instead of mid-task. A missing or non-matching catalog warns and proceeds, since it is a secondary enrichment signal. * no-mistakes(review): docs: document mechanical fm-spawn.sh free-model gate and dual-path lookup * no-mistakes(document): docs: sync opencode harness ref with new health-catalog gate * fix(spawn): fix opencode mini detection regex, keep legacy interactive fallback, and support catalog override
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.
Intent
디스패치 전 opencode-free-models.json에서 모델 살아있는지(만료/조기종료 아닌지) 확인 필요.
이거 놓치지 않게 지침이나 강제 훅 등 수정해.
What Changed
bin/fm-spawn.shadds a mechanical health check before dispatching an opencode free-model candidate: it looks up the model inopencode-free-models.json(checking the same two candidate paths, in the same order, thatopencode_model_router.py'sload_catalog()uses), refuses dispatch (exit 1) when the entry'sstatusisn'tactiveorearly_termination_detectedistrue, warns onis_expiring_soon, and warns (without blocking) when the catalog file is missing or the model isn't found.docs/model-dispatch-rigor.mddocuments the new mechanical gate, clarifies thatis_expiring_soonnarrowing andscanned_atstaleness remain manual judgment calls out of the gate's scope, and updates the harness-adapters opencode reference accordingly.tests/fm-spawn-dispatch-profile.test.shadds coverage for the new health-gate branches (missing catalog, inactive/terminated entries, expiring warning).🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is a small, well-tested, additive gate in fm-spawn.sh with good test coverage of its branches (missing catalog, active, terminated, inactive, untracked model); the only gaps are a missing staleness check (mechanical, matches documented intent) and an extra undocumented fallback path (scope question), neither of which risks breaking existing behavior.
Testing
Ran the 5 new health-gate tests end-to-end against the real fm-spawn.sh in an isolated fixture HOME/worktree; all 5 passed (missing catalog warns+proceeds, active entry proceeds, early-terminated refuses, inactive-status refuses, untracked-model warns+proceeds). Full 1849-line suite run was killed after hanging ~20min on an unrelated pre-existing ultra-batch test spawning a real subprocess tree, unrelated to this change; the targeted subset isolates and confirms the new behavior live.
Evidence: Targeted health-gate test run output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-spawn.sh:2228- The new gate reads status/early_termination_detected/is_expiring_soon from the opencode-free-models.json entry but never checks the catalog's scan freshness (scanned_at), even though docs/model-dispatch-rigor.md explicitly documents that rule: 'If scanned_at is older than ~10 days ... treat the data as stale ... A stale scan is a reason to narrow more, never a reason to skip the check.' As written, a catalog the weekly cron stopped refreshing will keep reporting whatever status/flags it had at last scan (e.g. status=active) even though the real model may have since expired or been early-terminated, so the 'forced' gate silently passes a dead model. This is squarely within the user's stated intent (check whether the model is alive/not expired/not early-terminated before dispatch) and the doc already defines the exact staleness rule to apply; no new state/schema is needed since scanned_at is already part of the documented catalog format.bin/fm-spawn.sh:2221- A second, undocumented fallback catalog path ($HOME/Developer/IMAC/data/opencode-free-models.json) was added alongside the one location docs/model-dispatch-rigor.md actually names (AutomationSync/knowledge/opencode-free-models.json, written by opencode_free_model_scanner.py). Nothing in the user intent or the existing docs calls for a second source location, and it is untested. Recommend removing the second candidate and keeping the single documented path unless there's an undocumented reason for it.🔧 Fix applied.
1 warning still open:
bin/fm-spawn.sh:2228- The new gate reads status/early_termination_detected/is_expiring_soon from the opencode-free-models.json entry but never checks the catalog's scan freshness (scanned_at), even though docs/model-dispatch-rigor.md explicitly documents that rule: 'If scanned_at is older than ~10 days ... treat the data as stale ... A stale scan is a reason to narrow more, never a reason to skip the check.' As written, a catalog the weekly cron stopped refreshing will keep reporting whatever status/flags it had at last scan (e.g. status=active) even though the real model may have since expired or been early-terminated, so the 'forced' gate silently passes a dead model. This is squarely within the user's stated intent (check whether the model is alive/not expired/not early-terminated before dispatch) and the doc already defines the exact staleness rule to apply; no new state/schema is needed since scanned_at is already part of the documented catalog format.✅ **Test** - passed
✅ No issues found.
bash tests/.health-gate-test.sh (trimmed copy running only the 5 new opencode-health tests plus required setup) against the real bin/fm-spawn.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.