You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: discover dispatch models from harness catalogs - #5485
api_response:
body: "## Intent\n\nfor jev, i need it to use available models maybe through a method call and use those... the handwritten shortlist won't cut it. esp since 5.5 is getting depracated.\n\nrouting: proposed design sounds expensinve. we need a repeatable, caheable method call so agents dont' burn tokens discovering - 5.5 will only be deprecated later in october\n\ngo ahead and build the routing tool, no cache necessary if we're using tools own mehtod.\n\nContext: today bin/fm-dispatch-resolve.sh has Jev classify a brief into a task-type rule in config/crew-dispatch.json, and each rule carries a hand-written candidate model list; the quota-array-dispatch procedure then ranks those candidates by quota. The investigation report at ~/firstmate/data/opencode-go-access/report.md ("Recommended design" section) proposes discovering candidates at dispatch time from each harness's own model catalog, joined with live quota and task-type fit evidence, with fm-dispatch-resolve.sh remaining the single decision owner and a narrow catalog helper normalizing each harness's native listing.\n\n## What Changed\n- Added a harness-native model catalog helper with normalized model, provider, capability, and provenance data.\n- Extended typed dispatch resolution and bootstrap validation to support dynamic discovery with provider, task-fit, reasoning-fit, quota, and timeout handling.\n- Added documentation and test coverage for dynamic candidates, defaults, live catalog normalization, unsupported harnesses, and catalog failures.\n\n## Risk Assessment\n\n✅ Low: No additional review action is required from the fetched-content notification.\n\n## Testing\n\nThe resolver suite passed, isolated Pi discovery returned no fabricated candidates, and off-mode/bootstrap guards behaved correctly. Jev-backed model selection could not be exercised without credentials; broader bootstrap/spawn checks timed out on this host.\n\n- Live validation: ⚠️ inconclusive - 3 of 4 scenarios driven live against the product\n\n| Scenario | Result | Live | Evidence |\n| --- | --- | --- | --- |\n| Run native Pi discovery with an isolated account that has no providers; return an empty catalog without fabricating a model candidate. | ✅ pass | live | Live dispatch boundary transcript |\n| Run dispatch with no Typesafe key and a missing catalog directory; preserve the documented off behavior with exit 0 and no stdout. | ✅ pass | live | Live dispatch boundary transcript |\n| Bootstrap a dynamic-only dispatch rule without typed resolution; reject it with an actionable configuration diagnostic. | ✅ pass | live | Live bootstrap dynamic gate transcript |\n| Run Jev-backed dynamic dispatch against real harness catalogs and select an available launchable model using quota evidence. | ⏸️ pending firstmate verification | no | The Jev key is intentionally not exposed to the validation pipeline; firstmate will run this positive live check against this branch with the home key after the PR is up. |\n\n
\nEvidence: Resolver targeted test log\n\nSource: Resolver targeted test log\n\ntext\nok - absent key is off: one stderr line, exit 0, no network call\nok - TYPESAFE_API_KEY= in .env activates the tool; environment and config overrides work\nok - clear: one rule Choice request, key on the fd header only, spendPriority argmax over every candidate\nok - rules snapshots and shell quoting preserve the profile protocol\nok - no-rule fallback, Agy, Gemini, and documented configurations resolve\nok - ambiguous: confidence below the fixed floor hands the decision back\nok - escalate: a rule declared approval: captain never yields a profile\nok - rule floor: known shortfall falls through while unavailable evidence escalates\nok - declared provider and profile floor evidence are applied in code\nok - nonnumeric spendPriority evidence is never ranked\nok - partial and missing quota evidence remain eligible but unranked\nok - provider-wide and exact quota rows combine into one limiting candidate\nok - default: no rule matched resolves among the default profiles\nok - tie: equal spendPriority never breaks by array order\nok - no rankable candidate: the tool escalates instead of guessing\nok - native Codex binds to codex-home before default, independently of Pi accounts and row order\nok - Pi native adapters bind to codex-home with existing fallbacks and schema 5 compatibility\nok - schema 6: each candidate binds to its account row; schema 5 is unchanged\nok - quota evidence comes from one quota-axi --json read, and its failure is an error outcome\nok - dynamic discovery uses catalog rows, rejects unsupported harnesses, and reports timeout and unknown-quota cases\nok - API, transport, and response failures are error outcomes with exit 0\nok - configuration errors exit 2 before any network call\n# all fm-dispatch-resolve tests passed\nexit=0\n\n\n\nEvidence: Live dispatch boundary transcript\n\nSource: Live dispatch boundary transcript\n\ntext\nscenario: no-key dispatch must remain off even with a missing catalog directory\ncommand: FM_HOME=<isolated> FM_DISPATCH_PROJECT_DIR=<missing> TYPESAFE_API_KEY= bin/fm-dispatch-resolve.sh <brief>\nexit=0\nstdout_bytes=0\nstderr=dispatch-resolve: off (TYPESAFE_API_KEY absent from the environment and ~/.no-mistakes/worktrees/558623ebb989/01M38AAVAJJDE31QVE3PFK5N6B/.live-dispatch.NYQVbd/home/.env)\n\ncommand: PI_CODING_AGENT_DIR=<isolated> pi --list-models; PI_CODING_AGENT_DIR=<isolated> bin/fm-model-catalog.sh pi\npi_list_exit=0\ncatalog_exit=0\npi_list_stdout=No models available. Use /login to log into a provider via OAuth or API key. See:\n /opt/homebrew/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md\n /opt/homebrew/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md\ncatalog_stdout=\ncatalog_ok_rows=0\ncatalog_stderr=\n\n\n\nEvidence: Live bootstrap dynamic gate transcript\n\nSource: Live bootstrap dynamic gate transcript\n\ntext\ncommand: FM_HOME=<isolated> FM_BACKEND=tmux TYPESAFE_API_KEY= bin/fm-bootstrap.sh\nexit=0\nstdout=PRESENTATION_UNAVAILABLE: lavish-axi (requires >=0.1.77; install: npm install -g lavish-axi && lavish-axi setup hooks) - nonvisual work may proceed with plain-text decisions and reports; install or upgrade before using Lavish\nCREW_DISPATCH: invalid config/crew-dispatch.json - dynamic dispatch requires TYPESAFE_API_KEY; configure concrete harness profiles for ordinary intake\nstderr=\n\n\n- Outcome: ⚠️ 2 warnings across 2 runs (29m28s)\n\n## Pipeline\n\nUpdates from git push no-mistakes\n\n\n\n\n✅ intent - passed\n\n✅ No issues found.\n\n\n\n✅ Rebase - passed\n\n✅ No issues found.\n\n\n\n🔧 Review - 5 issues found → auto-fixed (11) ✅\n\n- 🚨 docs/configuration.md:523 - Dynamic discovery is explicitly opt-in, so existing/example configurations still route Jev through handwritten profiles such as gpt-5.5; this contradicts the requirement that the shortlist not be used and leaves the deprecation risk reachable. Confirm whether migration to discovery is required.\n- 🚨 bin/fm-dispatch-resolve.sh:317 - task_type is accepted and passed to inferred_reasoning, but $task is never used; policies for implementation and documentation therefore produce identical fit results. This does not provide the required task-type fit evidence.\n- 🚨 bin/fm-dispatch-resolve.sh:320 - A dynamic policy requiring max can never select a model: even gpt-5.6-luna, documented as supporting max, is classified as xhigh by this regex and rejected. Use authoritative catalog reasoning capability data when evaluating the required class.\n- ⚠️bin/fm-dispatch-resolve.sh:485 - Dynamic candidates carry fit and catalog provenance internally, but the renderer emits neither; a clear result therefore cannot show the required reasoning-class fit or catalog evidence for eligible candidates. Include those fields in each candidate line.\n- ⚠️bin/fm-dispatch-resolve.sh:324 - preferred_models, preferred_families, and the preference bonus add an extra ranking rule not required by the stated goal; the bonus can select a lower-quota preferred model over a higher-spendPriority candidate. Remove this component unless the preference behavior is explicitly authorized.\n\n🔧 Fix applied.\n3 errors still open:\n\n- 🚨 bin/fm-model-catalog.sh:121 - Live catalog normalizers emit no taskTypes metadata; only fixture normalization preserves it. Consequently resolver task_fit() returns unknown and eligible for every real discovered model, so implementation and documentation policies produce the same candidate set and quota choice instead of applying task-type fit evidence.\n- 🚨 bin/fm-dispatch-resolve.sh:286 - Catalogs are collected only for Jev's selected rule. If that rule's quota floor is below threshold and the configured default is dynamic with different harnesses, expand_use() at line 463 sees an empty catalog and returns an error instead of resolving the documented dynamic default fallback.\n- 🚨 bin/fm-model-catalog.sh:121 - The OpenCode, Pi, and Claude live normalizers discard native reasoning-capability fields, forcing catalog_reasoning() to use model-name/provider regex inference. A newly cataloged high-capability opencode-go model can therefore be rejected as medium, while a low-capability model whose name matches a hardcoded pattern can pass a high requirement without error.\n\n🔧 Fix applied.\n3 issues (2 errors, 1 warning) still open:\n\n- 🚨 bin/fm-model-catalog.sh:443 - Dynamic validation accepts every verified harness, but the catalog helper only implements five. A valid dynamic policy using cursor, grok, kimi, gemini, muse, rovo, omp, agy, or devin reaches this branch and always returns an unsupported-harness error, so those available models can never be discovered or selected. Add the native catalog methods or explicitly reject unsupported harnesses during validation.\n- 🚨 bin/fm-model-catalog.sh:99 - The verified OpenCode contract uses opencode models [provider], but this invokes opencode --pure models --verbose and the parser accepts only JSON lines. A normal documented text listing produces no rows, causing dynamic OpenCode dispatch to report no catalog result instead of selecting an available model.\n- ⚠️bin/fm-model-catalog.sh:159 - The pi-signed path is accepted but always executes plain pi. If only the signed executable is installed, discovery fails; if their catalogs differ, the resolver can select a model unavailable to the selected harness/account. Invoke the selected harness executable rather than hardcoding pi.\n\n🔧 Fix applied.\n2 issues (1 error, 1 warning) still open:\n\n- 🚨 bin/fm-dispatch-resolve.sh:291 - mapfile is unavailable in the stock macOS Bash 3.2 that this repository explicitly supports. Because the resolver runs this unconditionally after Jev answers, typed dispatch can abort before producing structured output for both static and dynamic configurations.\n- ⚠️bin/fm-model-catalog.sh:105 - The OpenCode and Pi parsers invoke python3 without checking it exists or emitting an error row. On a valid host with the harness installed but no Python, discovery silently produces no candidates and returns a generic missing-result error instead of identifying the unavailable parser dependency.\n\n🔧 Fix applied.\n3 issues (1 error, 2 warnings) still open:\n\n- 🚨 bin/fm-model-catalog.sh:235 - Pi catalog rows retain native providers such as openai-codex, but the resolver joins quota rows using normalized IDs such as codex; dynamic Pi candidates therefore become unranked or are filtered out by providers:["codex"]. The structured-parser branch also emits a bare model ID that Pi cannot launch under its provider-qualified model contract. Normalize the authoritative catalog provider relationship and preserve provider-qualified model IDs before ranking.\n- ⚠️bin/fm-model-catalog.sh:238 - The pi-signed path invokes pi-signed, but emitted provenance is hardcoded to pi --list-models. A dynamic signed-Pi result therefore reports the wrong catalog source, undermining the required evidence trail. Render the selected executable in provenance.\n- ⚠️bin/fm-dispatch-resolve.sh:302 - Catalog collection includes the dynamic default even when Jev selected a static rule that will not fall through. A static dispatch with a dynamic default consequently launches up to the catalog timeout of each default harness and may touch its credentials, while the result is discarded. Collect the default catalog only when default routing is actually selected or required by a quota-floor fallback.\n\n🔧 Fix applied.\n3 issues (1 error, 2 warnings) still open:\n\n- 🚨 bin/fm-model-catalog.sh:401 - The Codex catalog method invokes codex app-server --listen stdio://, but the repository's verified interface is codex app-server --stdio. On supported Codex installations this fails before model/list, so every dynamic policy containing codex returns a catalog error instead of discovering available models.\n- ⚠️bin/fm-dispatch-resolve.sh:303 - Any matched rule containing a quota floor collects dynamic default catalogs before quota evidence is available, even when the floor is healthy or unverifiable and default routing will not be used. This unnecessarily invokes catalog commands, may touch credentials, and can wait for their timeout; collect the default only after confirming a below-floor fallback is required.\n- ⚠️bin/fm-dispatch-resolve.sh:404 - The new preferred_models/preferred_families options and preference annotation add policy surface not required by the authoritative intent (catalog availability, quota, and task-type fit), and they do not affect ranking. Remove this optional preference machinery rather than retaining dead routing complexity.\n\n🔧 Fix applied.\n2 issues (1 error, 1 warning) still open:\n\n- 🚨 bin/fm-model-catalog.sh:203 - Pi discovery always passes -ne/--no-extensions, but Pi's authoritative catalog includes extension-registered and custom-provider models. A dynamic Pi policy therefore reports those available models as absent and returns an error instead of selecting them. Preserve extension discovery for catalog calls.\n- ⚠️bin/fm-dispatch-resolve.sh:324 - Dynamic catalog commands run with the resolver's ambient Claude/Pi account, while fm-spawn.sh later applies config/claude-account or config/pi-account to the worker. With a pinned account whose catalog differs, Jev can select a model unavailable to the actual worker account. Run discovery under the same resolved worker-account environment before ranking.\n\n🔧 Fix applied.\n3 issues (2 errors, 1 warning) still open:\n\n- 🚨 bin/fm-model-catalog.sh:172 - OpenCode requires --model <provider/model>, but a catalog row such as { "id": "space-bunny-free", "providerID": "opencode-go" } is emitted with the bare model ID. The resolver can then return a clear profile that fm-spawn.sh cannot launch. Normalize unqualified OpenCode IDs to provider/model while preserving already-qualified IDs.\n- 🚨 bin/fm-dispatch-resolve.sh:356 - Pinned Pi account resolution returns the declared provider allowlist, but discovery discards it and ranks every model listed from that account. With config/pi-account allowing only codex while the root also lists Anthropic, discovery can select anthropic/model; fm-spawn.sh then rejects the clear profile because the provider is not declared. Filter discovered rows by the pinned account's providers before ranking.\n- ⚠️bin/fm-model-catalog.sh:203 - Pi discovery now loads extensions, but the resolver never supplies the target worker project as the catalog command's working directory. Project-local extension providers can therefore be omitted or models from the resolver's unrelated current directory can be treated as available for the worker. Run discovery in the actual target worktree (or pass that directory explicitly).\n\n🔧 Fix applied.\n3 issues (1 error, 2 warnings) still open:\n\n- 🚨 bin/fm-model-catalog.sh:55 - Pi catalog normalization does not map the supported codex-native provider to quota family codex. A discovered codex-native/<model> is either filtered out by providers:["codex"] or joins no quota row and remains permanently unranked, even though Pi and the quota contract explicitly support this native lane.\n- ⚠️bin/fm-dispatch-resolve.sh:107 - The new catalog-directory validation runs before the TYPESAFE_API_KEY opt-in gate. With the resolver intentionally off but FM_DISPATCH_PROJECT_DIR or --project pointing at a missing directory, the command exits 2 instead of preserving the documented off behavior of one stderr line and exit 0.\n- ⚠️bin/fm-bootstrap.sh:1154 - Dynamic discover objects are recognized and accepted even when typed resolution is inactive. A dynamic-only rule with no TYPESAFE_API_KEY therefore bypasses the pre-existing required-harness validation and is reported as valid, although the documented dynamic form is expanded only by typed resolution and the ordinary intake has no concrete harness profile.\n\n🔧 Fix applied.\n1 warning still open:\n\n- ⚠️bin/fm-dispatch-resolve.sh:125 - The resolver validates CATALOG_CWD before reading rules or determining whether the selected route uses dynamic discovery. A static dispatch, absent-rules path, or stale FM_DISPATCH_PROJECT_DIR therefore exits 2 for a missing catalog directory even though no catalog is needed. Defer directory resolution and validation until dynamic catalog collection is actually required.\n\n🔧 Fix applied.\n1 error still open:\n\n- 🚨 bin/fm-model-catalog.sh:362 - Claude discovery prefers model.value over resolvedModel. When value is an alias such as sonnet and resolvedModel is the canonical model ID, dynamic quota matching uses the alias and misses an applicable model:<resolvedModel> bound, allowing routing to a model whose exact quota is exhausted. Use the canonical resolved model for quota identity while retaining the alias only as launch metadata if needed.\n\n🔧 Fix applied.\n✅ Re-checked - no issues remain.\n\n\n\n⚠️Test - 2 warnings\n\n- 🚨 bin/fm-model-catalog.sh:274 - With an isolated Pi account, the real pi --list-models reports no models, but the text fallback parses the message as provider/model and returns a false No/models candidate. Dynamic discovery should emit an error or empty catalog instead.\n- 🚨 live validation verdict: no-go (2 of 3 scenarios were driven live against the product); failed: Invoke native Pi model discovery in an isolated account with no configured providers; the catalog returns no fabricated model candidate\n- Live validation: ❌ no-go - 2 of 3 scenarios driven live against the product\n\n| Scenario | Result | Live | Evidence |\n| --- | --- | --- | --- |\n| Run resolver with typed routing disabled and a missing catalog project; it remains off without validating the project directory | ✅ pass | live | Live dispatch surface checks |\n| Invoke native Pi model discovery in an isolated account with no configured providers; the catalog returns no fabricated model candidate | ❌ fail | live | Live Pi catalog output and Native Pi no-model response |\n| Dispatch a dynamic rule using currently available harness models joined with live quota and task-fit evidence | ⏸️ untested | no | No Typesafe API credential or provider credentials were available. Provide an isolated Typesafe key and authenticated provider/quota setup to drive this end to end. |\n\n- tests/fm-dispatch-resolve.test.sh\n- tests/fm-bootstrap.test.sh\n- Live resolver off-path with a missing project directory\n- Live bin/fm-model-catalog.sh --list-harnesses\n- Live isolated pi --list-models and bin/fm-model-catalog.sh pi\n\n🔧 Fix applied.\n2 warnings still open:\n\n- ⚠️ Positive Jev-backed dynamic routing was not live-tested because no TYPESAFE_API_KEY or approved production credential injection was available. Provide an isolated key injection and rerun this phase.\n- ⚠️ live validation verdict: inconclusive (3 of 4 scenarios were driven live against the product); untested: Run Jev-backed dynamic dispatch against real harness catalogs and select an available launchable model using quota evidence.\n- Live validation: ⚠️ inconclusive - 3 of 4 scenarios driven live against the product\n\n| Scenario | Result | Live | Evidence |\n| --- | --- | --- | --- |\n| Run native Pi discovery with an isolated account that has no providers; return an empty catalog without fabricating a model candidate. | ✅ pass | live | Live dispatch boundary transcript |\n| Run dispatch with no Typesafe key and a missing catalog directory; preserve the documented off behavior with exit 0 and no stdout. | ✅ pass | live | Live dispatch boundary transcript |\n| Bootstrap a dynamic-only dispatch rule without typed resolution; reject it with an actionable configuration diagnostic. | ✅ pass | live | Live bootstrap dynamic gate transcript |\n| Run Jev-backed dynamic dispatch against real harness catalogs and select an available launchable model using quota evidence. | ⏸️ pending firstmate verification | no | The Jev key is intentionally not exposed to the validation pipeline; firstmate will run this positive live check against this branch with the home key after the PR is up. |\n\n- bash tests/fm-dispatch-resolve.test.sh\n- Live isolated pi --list-models and bin/fm-model-catalog.sh pi with no providers\n- Live no-key dispatch with a missing project directory\n- Live bootstrap validation of dynamic-only rules without a Typesafe key\n\n\n\n✅ Document - passed\n\n✅ No issues found.\n\n\n\n⚠️Lint - 1 warning\n\n- ⚠️ linter found issues (exit code 1)\n\n\n\n✅ Push - passed\n\n✅ No issues found.\n"
truncated: false
Diff review on HEAD e58290f555fc267d25a2c4d29383e5613b3bddcf: adds bin/fm-model-catalog.sh and typed-dispatch discover policies that expand candidates from harness catalogs. Ordinary concrete use profiles and absent-TYPESAFE_API_KEY stay off. Dynamic rules require typed resolution + verified harnesses with a catalog method; catalog failure/timeout is error, not a stale-list fallback. Security clean for fork CI (bounded catalog CLI calls under account pin; no workflow/cred writes).
VISION per-rule:
One captain, one interface — aligns when opt-in (typed + discover config).
Authority explicit — aligns (TYPESAFE + discover grant; never ambient).
Scripts own mechanics / agents own judgment — aligns (catalog normalize in script; Jev still picks the rule).
Restart non-event — aligns (no new durable surface).
Delegation with a spine — aligns (quota/fit still gate spawn).
contract-class:opt-in — unconfigured homes (no TYPESAFE / no discover) unchanged; dynamic discovery only when a rule declares it under typed resolution.
attestation:INVALID — body comment has tip e58290f555fc but JSON is backslash-escaped (\"head_sha\"), so Require no-mistakes cannot parse structured attestation (runs 35946107627/35946665368 FAILURE: "missing structured pipeline step attestation"). Please re-raise through no-mistakes so the HTML comment is valid JSON. CI: FAILURE 35946107604 — Lint SC1007 (space after =), Lint SC2034 (catalog_declared unused), Behavior portable parallel 1 (same SC1007 exclusion). NM: FAILURE (attestation parse). mergeable: MERGEABLE/UNSTABLE. workflow-approved: yes this tip — CI 35946107604, NM 35946107627/35946665368. next: waiting-author (fix attestation escaping + ShellCheck). Not a captain hold. Firstmate-flag no. Closes none.
Speaking as Kun's firstmate: follow-up — overlapping #5478 (same dispatch-resolve surface) just merged squash → 795e4b58. This tip will need a no-mistakes re-raise/rebase onto current main after the attestation JSON + ShellCheck fixes. Still waiting-author (not a captain hold).
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
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.
api_response:⚠️ inconclusive - 3 of 4 scenarios driven live against the product\n\n| Scenario | Result | Live | Evidence |\n| --- | --- | --- | --- |\n| Run native Pi discovery with an isolated account that has no providers; return an empty catalog without fabricating a model candidate. | ✅ pass | live | Live dispatch boundary transcript |\n| Run dispatch with no Typesafe key and a missing catalog directory; preserve the documented off behavior with exit 0 and no stdout. | ✅ pass | live | Live dispatch boundary transcript |\n| Bootstrap a dynamic-only dispatch rule without typed resolution; reject it with an actionable configuration diagnostic. | ✅ pass | live | Live bootstrap dynamic gate transcript |\n| Run Jev-backed dynamic dispatch against real harness catalogs and select an available launchable model using quota evidence. | ⏸️ pending firstmate verification | no | The Jev key is intentionally not exposed to the validation pipeline; firstmate will run this positive live check against this branch with the home key after the PR is up. |\n\n
body: "## Intent\n\nfor jev, i need it to use available models maybe through a method call and use those... the handwritten shortlist won't cut it. esp since 5.5 is getting depracated.\n\nrouting: proposed design sounds expensinve. we need a repeatable, caheable method call so agents dont' burn tokens discovering - 5.5 will only be deprecated later in october\n\ngo ahead and build the routing tool, no cache necessary if we're using tools own mehtod.\n\nContext: today bin/fm-dispatch-resolve.sh has Jev classify a brief into a task-type rule in config/crew-dispatch.json, and each rule carries a hand-written candidate model list; the quota-array-dispatch procedure then ranks those candidates by quota. The investigation report at ~/firstmate/data/opencode-go-access/report.md ("Recommended design" section) proposes discovering candidates at dispatch time from each harness's own model catalog, joined with live quota and task-type fit evidence, with fm-dispatch-resolve.sh remaining the single decision owner and a narrow catalog helper normalizing each harness's native listing.\n\n## What Changed\n- Added a harness-native model catalog helper with normalized model, provider, capability, and provenance data.\n- Extended typed dispatch resolution and bootstrap validation to support dynamic discovery with provider, task-fit, reasoning-fit, quota, and timeout handling.\n- Added documentation and test coverage for dynamic candidates, defaults, live catalog normalization, unsupported harnesses, and catalog failures.\n\n## Risk Assessment\n\n✅ Low: No additional review action is required from the fetched-content notification.\n\n## Testing\n\nThe resolver suite passed, isolated Pi discovery returned no fabricated candidates, and off-mode/bootstrap guards behaved correctly. Jev-backed model selection could not be exercised without credentials; broader bootstrap/spawn checks timed out on this host.\n\n- Live validation:
Evidence: Resolver targeted test log
\n\nSource: Resolver targeted test log\n\ntext\nok - absent key is off: one stderr line, exit 0, no network call\nok - TYPESAFE_API_KEY= in .env activates the tool; environment and config overrides work\nok - clear: one rule Choice request, key on the fd header only, spendPriority argmax over every candidate\nok - rules snapshots and shell quoting preserve the profile protocol\nok - no-rule fallback, Agy, Gemini, and documented configurations resolve\nok - ambiguous: confidence below the fixed floor hands the decision back\nok - escalate: a rule declared approval: captain never yields a profile\nok - rule floor: known shortfall falls through while unavailable evidence escalates\nok - declared provider and profile floor evidence are applied in code\nok - nonnumeric spendPriority evidence is never ranked\nok - partial and missing quota evidence remain eligible but unranked\nok - provider-wide and exact quota rows combine into one limiting candidate\nok - default: no rule matched resolves among the default profiles\nok - tie: equal spendPriority never breaks by array order\nok - no rankable candidate: the tool escalates instead of guessing\nok - native Codex binds to codex-home before default, independently of Pi accounts and row order\nok - Pi native adapters bind to codex-home with existing fallbacks and schema 5 compatibility\nok - schema 6: each candidate binds to its account row; schema 5 is unchanged\nok - quota evidence comes from one quota-axi --json read, and its failure is an error outcome\nok - dynamic discovery uses catalog rows, rejects unsupported harnesses, and reports timeout and unknown-quota cases\nok - API, transport, and response failures are error outcomes with exit 0\nok - configuration errors exit 2 before any network call\n# all fm-dispatch-resolve tests passed\nexit=0\n\nEvidence: Live dispatch boundary transcript
\n\nSource: Live dispatch boundary transcript\n\ntext\nscenario: no-key dispatch must remain off even with a missing catalog directory\ncommand: FM_HOME=<isolated> FM_DISPATCH_PROJECT_DIR=<missing> TYPESAFE_API_KEY= bin/fm-dispatch-resolve.sh <brief>\nexit=0\nstdout_bytes=0\nstderr=dispatch-resolve: off (TYPESAFE_API_KEY absent from the environment and ~/.no-mistakes/worktrees/558623ebb989/01M38AAVAJJDE31QVE3PFK5N6B/.live-dispatch.NYQVbd/home/.env)\n\ncommand: PI_CODING_AGENT_DIR=<isolated> pi --list-models; PI_CODING_AGENT_DIR=<isolated> bin/fm-model-catalog.sh pi\npi_list_exit=0\ncatalog_exit=0\npi_list_stdout=No models available. Use /login to log into a provider via OAuth or API key. See:\n /opt/homebrew/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md\n /opt/homebrew/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md\ncatalog_stdout=\ncatalog_ok_rows=0\ncatalog_stderr=\n\nEvidence: Live bootstrap dynamic gate transcript
\n\nSource: Live bootstrap dynamic gate transcript\n\ntext\ncommand: FM_HOME=<isolated> FM_BACKEND=tmux TYPESAFE_API_KEY= bin/fm-bootstrap.sh\nexit=0\nstdout=PRESENTATION_UNAVAILABLE: lavish-axi (requires >=0.1.77; install: npm install -g lavish-axi && lavish-axi setup hooks) - nonvisual work may proceed with plain-text decisions and reports; install or upgrade before using Lavish\nCREW_DISPATCH: invalid config/crew-dispatch.json - dynamic dispatch requires TYPESAFE_API_KEY; configure concrete harness profiles for ordinary intake\nstderr=\n\n✅ intent - passed
\n\n✅ No issues found.\n✅ Rebase - passed
\n\n✅ No issues found.\n🔧 Review - 5 issues found → auto-fixed (11) ✅
\n\n- 🚨docs/configuration.md:523- Dynamic discovery is explicitly opt-in, so existing/example configurations still route Jev through handwritten profiles such as gpt-5.5; this contradicts the requirement that the shortlist not be used and leaves the deprecation risk reachable. Confirm whether migration to discovery is required.\n- 🚨bin/fm-dispatch-resolve.sh:317-task_typeis accepted and passed toinferred_reasoning, but$taskis never used; policies for implementation and documentation therefore produce identical fit results. This does not provide the required task-type fit evidence.\n- 🚨bin/fm-dispatch-resolve.sh:320- A dynamic policy requiringmaxcan never select a model: evengpt-5.6-luna, documented as supporting max, is classified asxhighby this regex and rejected. Use authoritative catalog reasoning capability data when evaluating the required class.\n-bin/fm-dispatch-resolve.sh:485- Dynamic candidates carry fit and catalog provenance internally, but the renderer emits neither; a clear result therefore cannot show the required reasoning-class fit or catalog evidence for eligible candidates. Include those fields in each candidate line.\n-bin/fm-dispatch-resolve.sh:324-preferred_models,preferred_families, and the preference bonus add an extra ranking rule not required by the stated goal; the bonus can select a lower-quota preferred model over a higher-spendPrioritycandidate. Remove this component unless the preference behavior is explicitly authorized.\n\n🔧 Fix applied.\n3 errors still open:\n\n- 🚨bin/fm-model-catalog.sh:121- Live catalog normalizers emit no taskTypes metadata; only fixture normalization preserves it. Consequently resolver task_fit() returns unknown and eligible for every real discovered model, so implementation and documentation policies produce the same candidate set and quota choice instead of applying task-type fit evidence.\n- 🚨bin/fm-dispatch-resolve.sh:286- Catalogs are collected only for Jev's selected rule. If that rule's quota floor is below threshold and the configured default is dynamic with different harnesses, expand_use() at line 463 sees an empty catalog and returns an error instead of resolving the documented dynamic default fallback.\n- 🚨bin/fm-model-catalog.sh:121- The OpenCode, Pi, and Claude live normalizers discard native reasoning-capability fields, forcing catalog_reasoning() to use model-name/provider regex inference. A newly cataloged high-capability opencode-go model can therefore be rejected as medium, while a low-capability model whose name matches a hardcoded pattern can pass a high requirement without error.\n\n🔧 Fix applied.\n3 issues (2 errors, 1 warning) still open:\n\n- 🚨bin/fm-model-catalog.sh:443- Dynamic validation accepts every verified harness, but the catalog helper only implements five. A valid dynamic policy using cursor, grok, kimi, gemini, muse, rovo, omp, agy, or devin reaches this branch and always returns an unsupported-harness error, so those available models can never be discovered or selected. Add the native catalog methods or explicitly reject unsupported harnesses during validation.\n- 🚨bin/fm-model-catalog.sh:99- The verified OpenCode contract usesopencode models [provider], but this invokesopencode --pure models --verboseand the parser accepts only JSON lines. A normal documented text listing produces no rows, causing dynamic OpenCode dispatch to report no catalog result instead of selecting an available model.\n-bin/fm-model-catalog.sh:159- Thepi-signedpath is accepted but always executes plainpi. If only the signed executable is installed, discovery fails; if their catalogs differ, the resolver can select a model unavailable to the selected harness/account. Invoke the selected harness executable rather than hardcodingpi.\n\n🔧 Fix applied.\n2 issues (1 error, 1 warning) still open:\n\n- 🚨bin/fm-dispatch-resolve.sh:291-mapfileis unavailable in the stock macOS Bash 3.2 that this repository explicitly supports. Because the resolver runs this unconditionally after Jev answers, typed dispatch can abort before producing structured output for both static and dynamic configurations.\n-bin/fm-model-catalog.sh:105- The OpenCode and Pi parsers invokepython3without checking it exists or emitting an error row. On a valid host with the harness installed but no Python, discovery silently produces no candidates and returns a generic missing-result error instead of identifying the unavailable parser dependency.\n\n🔧 Fix applied.\n3 issues (1 error, 2 warnings) still open:\n\n- 🚨bin/fm-model-catalog.sh:235- Pi catalog rows retain native providers such asopenai-codex, but the resolver joins quota rows using normalized IDs such ascodex; dynamic Pi candidates therefore become unranked or are filtered out byproviders:["codex"]. The structured-parser branch also emits a bare model ID that Pi cannot launch under its provider-qualified model contract. Normalize the authoritative catalog provider relationship and preserve provider-qualified model IDs before ranking.\n-bin/fm-model-catalog.sh:238- Thepi-signedpath invokespi-signed, but emitted provenance is hardcoded topi --list-models. A dynamic signed-Pi result therefore reports the wrong catalog source, undermining the required evidence trail. Render the selected executable in provenance.\n-bin/fm-dispatch-resolve.sh:302- Catalog collection includes the dynamic default even when Jev selected a static rule that will not fall through. A static dispatch with a dynamic default consequently launches up to the catalog timeout of each default harness and may touch its credentials, while the result is discarded. Collect the default catalog only when default routing is actually selected or required by a quota-floor fallback.\n\n🔧 Fix applied.\n3 issues (1 error, 2 warnings) still open:\n\n- 🚨bin/fm-model-catalog.sh:401- The Codex catalog method invokescodex app-server --listen stdio://, but the repository's verified interface iscodex app-server --stdio. On supported Codex installations this fails beforemodel/list, so every dynamic policy containing codex returns a catalog error instead of discovering available models.\n-bin/fm-dispatch-resolve.sh:303- Any matched rule containing a quota floor collects dynamic default catalogs before quota evidence is available, even when the floor is healthy or unverifiable and default routing will not be used. This unnecessarily invokes catalog commands, may touch credentials, and can wait for their timeout; collect the default only after confirming a below-floor fallback is required.\n-bin/fm-dispatch-resolve.sh:404- The newpreferred_models/preferred_familiesoptions and preference annotation add policy surface not required by the authoritative intent (catalog availability, quota, and task-type fit), and they do not affect ranking. Remove this optional preference machinery rather than retaining dead routing complexity.\n\n🔧 Fix applied.\n2 issues (1 error, 1 warning) still open:\n\n- 🚨bin/fm-model-catalog.sh:203- Pi discovery always passes-ne/--no-extensions, but Pi's authoritative catalog includes extension-registered and custom-provider models. A dynamic Pi policy therefore reports those available models as absent and returns an error instead of selecting them. Preserve extension discovery for catalog calls.\n-bin/fm-dispatch-resolve.sh:324- Dynamic catalog commands run with the resolver's ambient Claude/Pi account, whilefm-spawn.shlater appliesconfig/claude-accountorconfig/pi-accountto the worker. With a pinned account whose catalog differs, Jev can select a model unavailable to the actual worker account. Run discovery under the same resolved worker-account environment before ranking.\n\n🔧 Fix applied.\n3 issues (2 errors, 1 warning) still open:\n\n- 🚨bin/fm-model-catalog.sh:172- OpenCode requires--model <provider/model>, but a catalog row such as{ "id": "space-bunny-free", "providerID": "opencode-go" }is emitted with the bare model ID. The resolver can then return a clear profile thatfm-spawn.shcannot launch. Normalize unqualified OpenCode IDs toprovider/modelwhile preserving already-qualified IDs.\n- 🚨bin/fm-dispatch-resolve.sh:356- Pinned Pi account resolution returns the declared provider allowlist, but discovery discards it and ranks every model listed from that account. Withconfig/pi-accountallowing onlycodexwhile the root also lists Anthropic, discovery can selectanthropic/model;fm-spawn.shthen rejects the clear profile because the provider is not declared. Filter discovered rows by the pinned account's providers before ranking.\n-bin/fm-model-catalog.sh:203- Pi discovery now loads extensions, but the resolver never supplies the target worker project as the catalog command's working directory. Project-local extension providers can therefore be omitted or models from the resolver's unrelated current directory can be treated as available for the worker. Run discovery in the actual target worktree (or pass that directory explicitly).\n\n🔧 Fix applied.\n3 issues (1 error, 2 warnings) still open:\n\n- 🚨bin/fm-model-catalog.sh:55- Pi catalog normalization does not map the supportedcodex-nativeprovider to quota familycodex. A discoveredcodex-native/<model>is either filtered out byproviders:["codex"]or joins no quota row and remains permanently unranked, even though Pi and the quota contract explicitly support this native lane.\n-bin/fm-dispatch-resolve.sh:107- The new catalog-directory validation runs before the TYPESAFE_API_KEY opt-in gate. With the resolver intentionally off butFM_DISPATCH_PROJECT_DIRor--projectpointing at a missing directory, the command exits 2 instead of preserving the documented off behavior of one stderr line and exit 0.\n-bin/fm-bootstrap.sh:1154- Dynamicdiscoverobjects are recognized and accepted even when typed resolution is inactive. A dynamic-only rule with no TYPESAFE_API_KEY therefore bypasses the pre-existing required-harness validation and is reported as valid, although the documented dynamic form is expanded only by typed resolution and the ordinary intake has no concrete harness profile.\n\n🔧 Fix applied.\n1 warning still open:\n\n-bin/fm-dispatch-resolve.sh:125- The resolver validates CATALOG_CWD before reading rules or determining whether the selected route uses dynamic discovery. A static dispatch, absent-rules path, or stale FM_DISPATCH_PROJECT_DIR therefore exits 2 for a missing catalog directory even though no catalog is needed. Defer directory resolution and validation until dynamic catalog collection is actually required.\n\n🔧 Fix applied.\n1 error still open:\n\n- 🚨bin/fm-model-catalog.sh:362- Claude discovery prefersmodel.valueoverresolvedModel. Whenvalueis an alias such assonnetandresolvedModelis the canonical model ID, dynamic quota matching uses the alias and misses an applicablemodel:<resolvedModel>bound, allowing routing to a model whose exact quota is exhausted. Use the canonical resolved model for quota identity while retaining the alias only as launch metadata if needed.\n\n🔧 Fix applied.\n✅ Re-checked - no issues remain.\n⚠️ Test - 2 warnings
\n\n- 🚨bin/fm-model-catalog.sh:274- With an isolated Pi account, the realpi --list-modelsreports no models, but the text fallback parses the message as provider/model and returns a falseNo/modelscandidate. Dynamic discovery should emit an error or empty catalog instead.\n- 🚨 live validation verdict: no-go (2 of 3 scenarios were driven live against the product); failed: Invoke native Pi model discovery in an isolated account with no configured providers; the catalog returns no fabricated model candidate\n- Live validation: ❌ no-go - 2 of 3 scenarios driven live against the product\n\n| Scenario | Result | Live | Evidence |\n| --- | --- | --- | --- |\n| Run resolver with typed routing disabled and a missing catalog project; it remains off without validating the project directory | ✅ pass | live | Live dispatch surface checks |\n| Invoke native Pi model discovery in an isolated account with no configured providers; the catalog returns no fabricated model candidate | ❌ fail | live | Live Pi catalog output and Native Pi no-model response |\n| Dispatch a dynamic rule using currently available harness models joined with live quota and task-fit evidence | ⏸️ untested | no | No Typesafe API credential or provider credentials were available. Provide an isolated Typesafe key and authenticated provider/quota setup to drive this end to end. |\n\n-tests/fm-dispatch-resolve.test.sh\n-tests/fm-bootstrap.test.sh\n-Live resolver off-path with a missing project directory\n-Live\n-bin/fm-model-catalog.sh --list-harnessesLive isolated\n\n🔧 Fix applied.\n2 warnings still open:\n\n-pi --list-modelsandbin/fm-model-catalog.sh pibash tests/fm-dispatch-resolve.test.sh\n-Live isolated\n-pi --list-modelsandbin/fm-model-catalog.sh piwith no providersLive no-key dispatch with a missing project directory\n-Live bootstrap validation of dynamic-only rules without a Typesafe key\n✅ Document - passed
\n\n✅ No issues found.\n⚠️ Lint - 1 warning
\n\n-✅ Push - passed
\n\n✅ No issues found.\ntruncated: false