Skip to content

feat(routing)!: autorouting with policy-derived tiers, preset layer removed - #4543

Open
Yeachan-Heo wants to merge 51 commits into
devfrom
feat/autorouting
Open

feat(routing)!: autorouting with policy-derived tiers, preset layer removed#4543
Yeachan-Heo wants to merge 51 commits into
devfrom
feat/autorouting

Conversation

@Yeachan-Heo

@Yeachan-Heo Yeachan-Heo commented Aug 14, 2026

Copy link
Copy Markdown
Owner

gajae.pr-review-verdict.v1 merge-approved sha256:bdb921ce0871e6ea432d22ec6998281159b632efa8f09e0dda2f8eebd22bc9eb reviewer:human reviewer-id:probepark evidence:exact-head-cd488501-routing-is-opt-in-explicitly-applied-and-adds-no-credential-source-changelog-debris-flagged

Supersedes #3764, which was closed without merge because exact-head Dev CI was red across unrelated current-dev surfaces. This is the same reviewed branch, rebased onto a much newer dev (271 commits of drift), with the preset layer now removed.

What

Opt-in sub-agent model autorouting for the Task tool, with tier chains derived from the provider-selection policy rather than a hardcoded preset table.

  • task.autorouting.enabled (default false) activates the fixed fast/balanced/strong tier vocabulary. Tiers come from task.autorouting.tiers; an omitted tier on a Task item routes as balanced; an autorouting pin overrides the manual model chain.
  • Selectors stay exact provider-qualified provider/modelId strings with an optional thinking suffix. Globs and prefixes are rejected.
  • /routing opens the smart-routing panel directly; /routing on|off toggles enablement; /routing status reports settings-derived state.

Preset-source unification

task.autorouting.preset and the whole preset layer are removed, not deprecated — there is no compatibility shim, per the repo's no-backward-compatibility rule.

  • projectProviderOrder is extracted as the single implementation of "configured modelProviderOrder first, then first-wins catalog order", and createProviderSelectionPolicy is rewritten on top of it.
  • ModelRegistry.autoroutingProviderOrder() takes no session and bypasses the policy builder entirely, so no effectiveAuth map is assembled: auth-independence is structural, not conventional. Auth-aware banding stays private to rank().
  • Comparison uses normalized ids while persistence keeps catalog spelling, because the generator matches provider prefixes case-sensitively — a lowercased CustomRouter would silently empty that provider's tiers.
  • Configured providers absent from the catalog are dropped before reaching setup.providers, so a dead declaration cannot pollute declarationFingerprint.
  • The panel seeds from derived priority with no hardcoded provider fallback and refuses entry when no providers are available. Refresh reseeds a recorded declaration and refuses to persist an empty result.

Breaking changes

  • task.autorouting.preset is gone. A preset-only configuration routes manually until tiers are generated.
  • Public TypeScript contracts drop AutoroutingEffective.source, RoutingOutcome.source, AUTOROUTING_PRESETS, AutoroutingPresetId, and resolveTierMap from ./config/*, plus TaskRoutingEvidence.source from ./task/*. The union collapsed to one value, so keeping it would have published a meaningless required field on a durable receipt.
  • Receipt and summary routing note values change format to tier/fallback/resume components only.
  • /routing status relabels settings-derived tiers, with malformed provenance failing closed as hand-authored instead of reporting generated.

Inactive-autorouting warning

Enabling autorouting without usable tiers previously failed silently. The host now decides once, where settings are already available, and reports through one shared uninterpolated constant on all three surfaces:

  • interactive and print read session.configWarnings;
  • ACP receives it through the existing SDK event replay ring. SessionEventStream retains frames, so a notice published at host start() reaches a client that attaches later; ACP captures it onto the session record without early render and republishes once during deferred bootstrap beside the auth-failure branch.

No new public query, no getSdkConfigItems/config.list expansion, no general configWarnings exposure, and no new event kind. The internal flag lives in a package-private module that is null-mapped in the package exports, with a guard test asserting it is unreachable from any published type.

Rebase notes

Rebased onto dev at f0453b6ab1. Two commits were dropped as genuinely obsolete rather than force-fitted:

Substantive conflict resolutions: dev removed its #writeTerminalBreadcrumb wrapper and the staged-publication/terminalBreadcrumbs fields, so those callsites were converted to dev's direct free-function form rather than reintroducing a wrapper; the /theme and /routing slash-command test blocks were unioned with correct closers.

Verification

  • check:types clean; repo-wide biome check exits 0.
  • Focused suites on the rebased tree: 98 pass across the autorouting contract/generator/tier-map/boundary suites, 113 pass across the task-routing, panel-integration, slash-command and ACP-notice suites, 336 pass across the session-staging and SDK/ACP suites.
  • AC10b is proven on a real lifecycle path: a real AcpAgent driven through newSession against a fixture broker observes exactly one [warning:autorouting] chunk, which only holds because the notice survives late-attach replay. Disabling the host emission fails it while the zero-notice case still passes.
  • Regressions added in this branch were negative-control verified — removing the spelling restore, the catalog-append branch, the host emission, or the export-map guard each fails the test that names it.
  • Mandatory computer-use red-team suite passes all seven cases (required because the change set touches config/settings-schema.ts).

bun run check currently fails on two gates that fail identically on a pristine origin/dev worktree at f0453b6ab1, measured on the same machine with shared node_modules:

  • the telegram baseline manifest reports the same five missing commands on both sides;
  • verify-gjc-sdk-canonicalization reports 27 violations on both sides, and the sorted violation sets diff empty. Every chain is rooted at the dev-owned session-state-sidecar.ts -> tools/descriptors.ts edge, and this branch touches none of the chain roots.

Opened as a draft because #3764's closure standard requires green current CI, and those dev-side surfaces are still red at this base.

Transplant onto current dev

Rebuilt from exact stale head e7b95a4ce957c00d36d532eae62a959ee9295c1b (event base cd51365cc270e27dceccfc2c184fadc9c1ddbe18) onto current dev d97b79eff2be5f25bf3ae253de72430e2e2fab1b. All 44 original commits replayed; three mechanical conflict resolutions (settings.ts union with dev's GLOBAL_ONLY_SETTINGS strip, config-cli.ts/test import unions, CHANGELOG section union); regenerated atomically: DAEMON_GENERATION 170→171 via the canonical --fix-generations tool, tier-map/tool-catalog/operation-inventory/schemas, and the 8 new dev catalog keys recorded as baseline skips. Rebasing continued cleanly across later dev advances (883ab16d97b79e; behind_dev=0 at push time).

Review findings fixed forward

  • P1 (generator casing): provider-prefix and allowlist matching now normalizes both sides while persistence keeps catalog spelling; provider de-duplication and validation run on normalized ids. Mixed-case regressions cover generated tiers and de-dup.
  • P2 (selector length): AUTOROUTING_SELECTOR_MAX_LENGTH = 256 is shared by reference between the selector grammar, the routing-evidence invariant, receipt bounding, and executor boundedSelector, so no accepted selector can be rejected after execution.
  • P1 (staging roots): the generic durable-preflight adoption is conditional on !options.managedPersistence, and commitStaged/discardStaged require strict attempt-root equality (absent or foreign adopted managers fail closed).
  • P2 (skip-list validation): the tier-map gate enforces selector grammar, non-empty rationale, catalog scope, and label/skip exclusivity (both-labeled-and-skipped reported as invalid, not stale); five dead baseline keys pruned.

Independent review

An independent architect-lane review of the fix-forward delta returned Verdict: approve with zero P1 findings; its three hardening recommendations are applied in the head commit (share the selector bound and tighten staged-root invariants). An authenticated review from @probepark has been requested on the exact head.

Verification on this head

check (biome + tsc) clean; telegram generation guard --validate-current-tree passes; tier-map gate green at 4272 in-scope keys / 3927 baseline skips; 173 focused tests pass across the autorouting contract/generator/tier-map/provider-order/settings/private-seam/task-routing/preflight/red-team/ACP-notice cohorts. Inherited dev-side failure (byte-identical on pristine origin/dev): the telegram baseline manifest reports one missing command (notifications-telegram-topic-lease-renewal.test.ts), and Dev CI shard-1 carries the BisectTool set failing identically on dev's own CI.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Draft hold — reconciliation evidence vs current dev and #4561

Recorded heads before any action (exact-head discipline): this draft PR head 874c59f949ea7ec5331da4a13142e7458ce836e9 (30 commits), merge-base with dev 3d9c8f2331, current dev 64c15281691280be7854dac04baeb05188328ef4. PR #4561 head 74156c1580cfb13ea9f5b11ec1195fc2b027f782 (5 commits, APPROVED, MERGEABLE, not merged into dev as of this check).

Reconciliation findings

1. Absorption by dev: none. 0 of the 30 PR commit patch-ids appear in dev since the base; dev contains no autorouting files at all. Nothing here was independently landed.

2. Textual conflicts vs current dev: exactly 1 file, mechanical. A real trial merge of this PR head into dev 64c1528 conflicts only in scripts/telegram-daemon-generation-manifest.json — a single digest hunk for sdk/bus/index.ts:createNotificationsExtension (dev 32faaf97… vs PR ba9b4354…). Cause: dev landed the notification-bus series (6e7c87a769, 5e25bde5b4, 153c73da00) after this PR's last rebase (46 dev commits since). Resolution is regenerating the digest, exactly what 874c59f949 did after the previous rebase. The 3 other both-sides files (sdk/bus/index.ts, sdk/host/session-runtime.ts, CHANGELOG.md) auto-merge cleanly.

3. Overlap with #4561 (oMLX presets): 4 files, 1 real conflict. Trial merge of #4561 onto this PR's head conflicts only in packages/coding-agent/src/task/executor.ts (~line 1713): this PR keeps the explicitThinkingLevel destructure; #4561's 8626a51bab removes it and replaces the effective-thinking gate with resolvedThinkingLevel ?? thinkingLevel for models without thinking config (oMLX). The other 3 overlap files (model-registry.ts, model-selector.ts, task/index.ts) auto-merge.

4. Not supersession — disjoint preset layers. The breaking removal here (5438dd6d2f) deletes only the autorouting preset tier-map layer (AUTOROUTING_PRESETS, AUTOROUTING_PRESET_IDS, AutoroutingPresetId, resolveTierMap, the task.autorouting.preset setting). It does not touch model-profiles.ts. #4561 builds model-profile presets (profile("omlx-qwen36-…"), groupModelProfilesForPresetLanding) plus oMLX provider plumbing (oauth/omlx.ts, port 8000, sentinel filtering) — none of which this PR removes. ModelSelectorViewMode on this head still includes "presets". The two coexist at the product layer: tiers route, profiles stay the manual-selection surface.

5. Residual semantic risk. #4561's thinking-level fallback changes the same resolution path this PR's routed :effort selectors depend on (AUTOROUTING_SELECTOR_PATTERN suffix → resolveModelOverrideWithAuthFallbackexplicitThinkingLeveleffectiveThinkingLevel at executor.ts:1786). Dev's model-resolver.ts:905 already carries the resolveThinkingLevelForModel(...) ?? resolved.thinkingLevel fallback, so the contracts converge — but the executor hunk must be hand-re-resolved when rebasing over 8626a51bab.

Owner decision (blocking)

  • (a) Rebase onto post-feat(ai,config): add oMLX hybrid role-optimized presets #4561 dev — evidence supports this cleanly: 1 mechanical manifest-digest regeneration + 1 hand-re-resolved executor.ts thinking hunk; no supersession.
  • (b) Hold as competing direction — the breaking task.autorouting.preset removal is a product default this lane must not choose.
  • (c) Close as supersedednot supported by evidence (disjoint layers, zero absorption).

This lane stays an explicitly owned draft hold: not marked ready, not pushed, not merged, not closed. All merge trials ran in throwaway worktrees and were aborted; no branch or ref was mutated.

— gaebal-gajae

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Evidence refresh — dev advanced to 96e718a2, #4561 head moved

Following exact-head discipline: the previous reconciliation comment was bound to dev 64c1528 and #4561 head 74156c158; both moved, so the trial-merge evidence was recomputed from scratch. Both trial merges ran in throwaway worktrees and were aborted; no ref was mutated.

Recomputed state (live REST/API):

Recomputed trial merge, this PR → dev 96e718a2: still exactly 1 conflict filescripts/telegram-daemon-generation-manifest.json, same single digest hunk (createNotificationsExtension: dev 32faaf97… vs this PR ba9b4354…). #4540's session-runtime.ts edits and this PR's edits there auto-merge cleanly (overlap files: CHANGELOG.md, session-runtime.ts only).

Recomputed trial merge, #4561 49e790f4f8 → this PR head: now 2 conflict filestask/executor.ts (same explicitThinkingLevel hunk at ~1713; bb1403448b removes it) and scripts/telegram-daemon-generation-manifest.json (new conflict: #4561's rebase onto dev brought manifest edits). File overlap grew to 5 (added CHANGELOG.md).

Unchanged conclusions, now bound to exact 96e718a2 + 49e790f4f8: absorption still 0/30 (no autorouting files/symbols on dev), preset layers still disjoint (this PR removes only the autorouting tier-map preset symbols and task.autorouting.preset; #4561 builds model-profiles()/oMLX plumbing untouched here). Verdict: partial overlap, not supersession.

Owner decision (blocking, unchanged): (a) rebase onto post-#4561 dev — now 1 mechanical digest regeneration + 1 hand-re-resolved executor.ts hunk + CHANGELOG.md; (b) hold as competing direction; (c) close as superseded — still unsupported. Lane remains an explicitly owned draft hold: not ready, not pushed, not merged, not closed.

— gaebal-gajae

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

OWNER-CONTROLLED DRAFT HOLD — verdict + evidence update (needs-human)

Verdict: NEEDS-HUMAN — owner decision required. Bound to the submitted PR digest via ls-remote (not a local trial): PR head refs/pull/4543/head = 874c59f949ea7ec5331da4a13142e7458ce836e9, recorded base 0f8624d177560461f3da4f02e459bc3d7624c031 (base branch dev), merge-base with dev 3d9c8f2331, 30 commits. Current refs/heads/dev = 96e718a2b0f2a46cad4876bf922886966c6fd0e3 (advanced from 64c1528 via #4540). PR #4561 current head refs/pull/4561/head = 49e790f4f8e6b2a8335a9f568ea46b9662c8e214 (force-moved from 74156c1580, rebased onto 64c1528; open, not draft, not merged into dev).

Conflict / supersession matrix (recomputed against exact 96e718a2 + 49e790f4f8)

Surface Result
Absorption of this PR by dev 0 of 30 commit patch-ids in dev since base; 0 autorouting files/symbols anywhere on 96e718a2
This PR → dev 96e718a2 trial merge 1 conflict file: scripts/telegram-daemon-generation-manifest.json (single digest hunk, createNotificationsExtension: dev 32faaf97… vs PR ba9b4354…); mechanical — regenerate digest as commit 874c59f949 did before. #4540's session-runtime.ts/CHANGELOG.md edits auto-merge with this PR's
#4561 (49e790f4f8) → this PR head trial merge 2 conflict files: task/executor.ts (~line 1713 explicitThinkingLevel hunk; #4561 commit bb1403448b removes it and switches to resolvedThinkingLevel ?? thinkingLevel) and telegram-daemon-generation-manifest.json (new: #4561's rebase brought manifest edits). Overlap set: model-registry.ts, model-selector.ts, executor.ts, task/index.ts, CHANGELOG.md
Supersession None. Preset layers are disjoint: this PR removes only AUTOROUTING_PRESETS, AUTOROUTING_PRESET_IDS, AutoroutingPresetId, resolveTierMap, task.autorouting.preset; #4561 never touches those symbols (0 matches) and builds model-profiles() presets + oMLX provider plumbing, untouched here. Partial overlap, not replacement
Residual semantic risk #4561's thinking-level fallback changes the same resolution path this PR's routed :effort selectors depend on (AUTOROUTING_SELECTOR_PATTERNexplicitThinkingLeveleffectiveThinkingLevel at executor.ts:1786) — the executor hunk must be hand-re-resolved at rebase time

Exact owner choices (pick one)

Lane state (unchanged by this update)

Draft, open, head 874c59f949, not pushed, not marked ready, not merged, not closed. Local worktree fast-forwarded to 96e718a2 (read-only bookkeeping; no push). All trial merges ran in throwaway worktrees, aborted and removed. Resumption of this lane requires fresh owner direction; the agent must not pick (a)/(b)/(c) on its own — choosing is a product-default decision reserved to the owner.

— gaebal-gajae

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Correction (exact-head discipline): #4561 head moved again after the hold comment posted. Current refs/pull/4561/head = c1b8e021273f553f14ba832ae1feb185e5309ff2 (was 49e790f4f8), now rebased onto dev 96e718a2 (merge-base verified). Trial merge of c1b8e0212 → this PR head recomputed: conflict surface unchanged — same 2 files (task/executor.ts explicitThinkingLevel hunk, telegram-daemon-generation-manifest.json), same 5-file overlap set. #4561 still open and unmerged, so option (a)'s "post-#4561 dev" still does not exist. Every other matrix row and the owner choices stand as posted. Any future resumption of this lane must re-verify #4561's head again before relying on these numbers.

— gaebal-gajae

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Rebased onto dev at 290b31c110 (101 commits of drift, including the fix(ci) exact-head PR-gate series). Head is now 4b9fea8f4f, behind_dev=0 at push time.

Rebase: 29 of 30 commits replayed with no conflicts. The only conflict was the regenerable telegram digest commit, which was skipped and regenerated against the new base instead of hand-merged.

Two adaptations dev forced:

  • 44 new catalog keys arrived with dev, so check:autorouting-map failed closed on uncurated coverage. They are recorded as baseline skips with an explicit rationale rather than given invented tier/rank data. Gate now passes at 4264 in-scope keys.
  • A stray blank line from the earlier #writeTerminalBreadcrumb conflict resolution reappeared. Last cycle I had folded that formatting fix into the telegram digest commit; skipping that commit this cycle discarded the fix with it, so it is now its own commit and will survive future rebases.

Focused verification on this base: check:types clean, repo-wide biome check exits 0, and 222 tests pass with 0 failures — 98 across the autorouting contract/generator/tier-map/boundary/private-seam suites, 124 across task-routing, preflight, red-team, panel integration, slash-command, ACP notice, tool-catalog, session-staging and SDK/ACP production-path.

Pre-existing dev failures (unchanged conclusion, re-measured against a pristine origin/dev worktree at 290b31c110, same machine, shared node_modules):

  • scripts/telegram-daemon-generation-guard.test.ts fails with ENOENT on packages/coding-agent/test/notifications-topic-registry.test.ts — identical failure on pristine dev.
  • The telegram baseline manifest reports 8 missing commands on both sides (was 5 at the previous base).
  • verify-gjc-sdk-canonicalization reports 27 violations on both sides with an empty sorted diff; every chain is rooted at the dev-owned session-state-sidecar.ts -> tools/descriptors.ts edge, and this branch touches none of the chain roots.

Still a draft for the reason #3764 was closed: the MERGE_READY bar wants green current CI, and those surfaces are red at this base independent of this branch.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Draft CI classification at exact head 4b9fea8f4f

This PR remains an owner-controlled Draft at head 4b9fea8f4f0dbdb2025886c97510db4dbf6f55b9, based on current dev 290b31c110889f375c7713b3f64bd10c6338093e. Run 31869555814 is still in progress; current failures classify as follows:

  1. Inherited current-dev failure — not PR-induced

  2. CI transport failure — not a product-test failure

    • shard-5 job 94976620842
    • tests reached completion, but actions/upload-artifact failed during FinalizeArtifact with ECONNRESET
  3. Genuine feat(routing)!: autorouting with policy-derived tiers, preset layer removed #4543 Draft blocker

    • Telegram generation guard job 94976007494
    • packages/coding-agent/src/sdk/bus/index.ts:createNotificationsExtension changes protected Telegram lifecycle behavior without the required strictly higher DAEMON_GENERATION
    • this must be corrected atomically with the repository generation tool before the Draft can become Ready
  4. Expected Draft merge gate

    • bootstrap is closed because this Draft has no merge-approved exact-head contract. It is not merge-ready.

No merge-ready claim is made. No duplicate browser fix belongs in this Draft. Preserve the owner-controlled Draft state; before any Ready transition, reconcile onto green dev after #4575, apply the required Telegram generation bump, rerun exact-head product CI, and obtain fresh review.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

CI repair pushed to feat/autorouting at d28445e7b9507cd8b27d2966a17f511ea346742e, rebased on current dev 1cc986422ae335bc155740b1060f6be10cfee4b4. Live API and origin/feat/autorouting both confirm that exact head; PR remains Draft.

Fixed product blockers:

  • Telegram lifecycle guard: canonical --fix-generations advanced DAEMON_GENERATION 168→169, updated the topic-registry pin and semantic manifest.
  • Managed OpenAI Responses replay sanitation now removes stale metadata in memory without appending entry_patch records.
  • Presetless model selector accepts minimal settings adapters while preserving the provider-order listener when available; provider onboarding offline refresh/config notification/selector visibility pass.
  • ACP autorouting fixture now registers, awaits, and closes its owned ACP session before broker-root teardown; repeated fresh Bun processes pass without root-recreation cleanup evidence.

Validation on the rebased head:

  • bun --cwd=packages/coding-agent run check
  • generation authority/current-tree validation plus scripts/telegram-daemon-generation-guard.test.ts and topic registry: 135 pass
  • replay + provider onboarding + ACP notice: 33 pass
  • session-storage cohort: 179 pass, 20 skipped
  • autorouting/model-selector cohort: 105 pass
  • ACP notice repeated in three independent Bun processes: 2 pass each.

Run 31869555814 is terminal and stale relative to this head. Classification retained: shard-1 browser default-root is inherited current-dev #4574 / PR #4575; shard-5 is GitHub FinalizeArtifact ECONNRESET; bootstrap is expected for this Draft; evidence-producer and aggregate failures are downstream of the repaired shard/guard failures.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Additional local fresh-process evidence: bun scripts/run-bun-test-files.ts --root=packages/coding-agent --shard=2/8 --timeout=30000 --file-timeout=120000 --concurrency=3 reran 177 files after rebase. The assigned OpenAI replay regression passed. The harness still reported autorouting-boundary-redteam.test.ts, task-autorouting-preflight.test.ts, and a timeout after successful exit for sdk-adapter-dispositions-daemon-cli.test.ts; these were not terminal blockers identified in run 31869555814 and were left unchanged to avoid broadening this owner-controlled CI repair.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

A queued affected-path regression exposed an additional PR-scope staging bug before its job terminalized. Fixed and pushed 4ead72d19399cc34d0999910dcb2373fd4752918 to feat/autorouting; live PR API and remote ref agree on that exact Draft head, still based on dev 1cc986422ae335bc155740b1060f6be10cfee4b4.

SessionManager.openStaged() no longer publishes a terminal --continue breadcrumb for an unpublished candidate. The breadcrumb is deferred until staged commit finalization, restoring the no-discovery-residue boundary. The durable C2 boundary test now has its required 30s window so it cannot leak timed-out async work into C3.

Validation: autorouting-boundary-redteam.test.ts 40 pass; task-autorouting-preflight.test.ts 21 pass; bun --cwd=packages/coding-agent run check pass. The prior replacement run 31871546786 is stale for this new head; its completed Telegram guard, Windows Telegram safety, and Windows session-path jobs were green. Bootstrap remains the expected Draft gate.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Terminal Dev CI classification for exact Draft head 4ead72d19399cc34d0999910dcb2373fd4752918 on dev 1cc986422ae335bc155740b1060f6be10cfee4b4: run 31872052977 completed with 74/74 jobs terminal.

Green repaired surfaces include Telegram generation guard (94983909330), Windows Telegram safety (94983909359), Windows session-path regression (94983909355), and all affected autorouting/session/model/ACP targeted jobs.

Failures are classified as:

Explicit owner-controlled Draft dependency hold: #4575 (9af837e5e017bcd2f5a2a802574853fab3c10a09) remains open and unmerged. Rebase #4543 only after it lands and dev advances green; then replacement CI must terminalize on that exact new base. PR remains Draft; no Ready or merge action taken.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Rebased the owner-controlled Draft onto exact dev 2e3ccb5895568ffec709b3adba25bc919d6d248b (#4577) and force-with-lease pushed exact head c9b6e0ef5cf007d866858e5ad06a5f460504a8fe to feat/autorouting. Live PR API and remote ref agree; Draft state remains unchanged. Replacement Dev CI is 31874899362.

#4577 overlap review: Command Code GOAT is retained as its own bundled model profile/provider recommendation and preset. Autorouting remains policy-tier derived and does not restore the removed preset layer; no duplicate profile removal or selector collision was introduced.

Focused validation: routing/model/ACP cohort 117 pass; replay/staging/Telegram cohort 162 pass; Command Code GOAT profile catalog 16 pass; provider onboarding 28 pass; coding-agent check and generation authority/current-tree validation pass.

model-registry.test.ts independently exposes five pre-existing shared-provider/environment cache assertions unrelated to the new GOAT profile mappings; replacement CI is the authority for final classification. Browser dependency hold on #4575 remains in force; no browser code was changed.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Terminal replacement CI classification: run 31874899362 completed 74/74 jobs for exact Draft head c9b6e0ef5cf007d866858e5ad06a5f460504a8fe on dev 2e3ccb5895568ffec709b3adba25bc919d6d248b.

Only product failure is shard-1 94989620493: 176/177 files green; browser-chrome-profile.test.ts default-root refusal is the byte-identical inherited #4574 regression. No autorouting, model-profile, ACP, replay, staging, or Telegram failure is present.

94989061182 bootstrap is the expected Draft gate. Evidence producer 94991903454 and aggregate 94991926255 are downstream only. #4575 remains open pending final merge; this owner-controlled Draft is explicitly held on that dependency. No Ready or merge action taken.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Freshness reset completed after #4575 merged. PR #4543 is rebased onto current dev 45885ea28793b0ace3523272b41f7ad07b1e88e5; exact Draft head is 15f657cd0f8d9fa09388814f121664bf1c93577e, verified by live API and origin/feat/autorouting. Canonical binary diff SHA-256: 33bccfab5c612225a4c734f3ac8afc4b4a10e8a35e7d240b7719c355e3562408.

Semantic overlap review retained #4575 Chrome default-root repair and later detached-managed snapshot work from dev; #4543 preserves policy-derived autorouting tiers and does not restore the removed preset layer. Protected Telegram lifecycle changes were regenerated atomically at generation 170.

Current evidence: routing/model/ACP/staging cohort 83 pass; replay/Telegram/browser cohort 190 pass; coding-agent check, binary build, guard authority/current-tree validation, and affected planner passed. Replacement Dev CI 31880204542 is running.

Honest Draft needs-human verdict: code and local verification are current, but readiness remains owner-controlled and CI must terminalize before any completion assessment. The obsolete #4575 dependency hold is removed; the live Ultragoal G001 ledger records this current-dev hold. Draft remains Draft: no Ready, approval request, merge, close, release, or tag action.


[repo owner’s gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Current exact-head terminal classification for owner-controlled Draft #4543:

  • Base/head: 804314081fe9d3f4d34014d1385f09d8d49a7116 / 4dadf96f1fa6174168b68d8140452d5043f266bb
  • Canonical binary full-index digest: a7b7de3ff1b5e9103954c521381b15d778ae1cc52ba90ced5e6c0b4651b42b68
  • Dev CI: 31885466467 is terminal. Its 72 product/platform jobs succeeded and one platform job was skipped. The sole failure is PR contract bootstrap, expected because the current exact-head verdict is intentionally needs-human; it is not a product failure.
  • Local exact CI-scrubbed root-check replay passed. The final worktree is clean, git diff --check is clean, and the PR verdict preflight validated the current digest.

This remains a Draft, owner-controlled readiness hold. No review, ready transition, merge, close, release, or tag action was taken.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Current-head CI failure classification for Draft #4543 (e7b95a4ce957c00d36d532eae62a959ee9295c1b, base cd51365cc270e27dceccfc2c184fadc9c1ddbe18):

  • Canonical affected-plan artifact dev-affected-plan-31889283833 confirms the exact shard command: bun scripts/run-bun-test-files.ts --root=packages/coding-agent --shard=N/8 --timeout=30000 --file-timeout=300000 --concurrency=1.
  • Shard 4 is a success control. Failed shard logs show ReferenceError: Cannot access 'END_PATCH_MARKER' before initialization in packages/coding-agent/src/edit/streaming.ts:85 in shards 1, 2, 3, 6, 7, and 8. The same focused test fails locally at the PR head (bun test packages/coding-agent/test/core/apply-patch.test.ts), and the PR delta does not touch streaming.ts; this is inherited shared module-initialization failure, not an autorouting repair target.
  • Additional inherited shared scraper TDZ traces are present: handleDockerHub in shard 2 and handleYouTube in shard 5, both in packages/coding-agent/src/web/scrapers/index.ts. These files are likewise outside the PR delta.
  • The dedicated shared edit repair is PR fix(coordinator): tolerate unsupported Windows directory sync #4459; it is not merged. Current dev is d332b7890ed95ff71d1a80e00bd4d31809558e69, and its Dev CI 31890215548 is terminal failure, so feat(routing)!: autorouting with policy-derived tiers, preset layer removed #4543 will not copy or substitute that repair. The unchanged autorouting delta must be reconstructed only after an authoritative repaired dev is available.

PR #4543 remains an owner-controlled Draft with needs-human; no readiness, review, merge, close, release, or tag action was taken.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Verdict: Request changes

Blocking findings:

  • P1 — packages/coding-agent/src/task/executor.ts, runSubagent() preflight setup and ManagedTaskPersistence.openStagedSession() (~330, ~1740–1780): both paths adopt staged artifact managers, leaving the first attempt root unreachable. Managed autorouting retries can orphan staging roots and leave durable filesystem residue. Centralize manager creation or make generic adoption conditional on !options.managedPersistence; add a lifecycle assertion that exactly one attempt root is used through commit/discard.
  • P2 — packages/coding-agent/scripts/check-autorouting-tier-map.ts, getAutoroutingTierMapGateReport() / checkAutoroutingTierMap(): skip-list rationale, duplicate, malformed, and out-of-scope entries are not validated. Future catalog entries can bypass curation with empty or stale skip entries. Enforce selector grammar, catalog scope, uniqueness, and non-empty rationale.

No tests or gates were run as part of this review.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Correction / superseding verdict

The earlier review comment on this PR was based on an incorrect diff scope and is superseded.

A subsequent exact-head review of e7b95a4ce957c00d36d532eae62a9599d3f4d34014d1385f09d8d49a7116 found only the Map.has preflight-fault classification change in packages/coding-agent/src/task/executor.ts plus regression coverage. The change correctly preserves thrown undefined values from the caller's error-transfer path instead of treating them as absent credentials and retrying the candidate. Existing absent-key and non-undefined behavior remains unchanged.

Corrected verdict: Approve / no actionable findings.

No tests or gates were run as part of the read-only review.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Final correction / superseding verdict

The previous approval correction was also based on an incomplete/local diff inspection and is superseded. The live PR has 44 commits and 71 changed files at the exact head.

Corrected verdict: Request changes.

  • P1 — packages/coding-agent/src/config/autorouting-generator.ts:164–166: setup provider IDs are accepted with arbitrary casing and provider ordering is case-insensitive, but tier generation matches provider prefixes and catalog keys case-sensitively. A valid setup such as providers: ["OpenAI"] against openai/... catalog keys produces empty fast/balanced/strong tiers.
    • Impact: autorouting can be enabled while silently falling back to manual model resolution for every Task item.
    • Fix: normalize provider IDs consistently at setup/generator/catalog boundaries, or reject non-canonical casing; add a mixed-case regression test covering generated tiers and fingerprints.

No tests or gates were run as part of this read-only review.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Additional exact-head finding

  • P2 — packages/coding-agent/src/task/autorouting-contract.ts:48–53: AUTOROUTING_SELECTOR_PATTERN / isValidAutoroutingSelector accept arbitrarily long model IDs, while assertRoutingEvidenceInvariant rejects a non-terminal effectiveModel longer than 256 characters.
    • Impact: a routed custom/provider model ID longer than 256 characters can execute successfully and then fail during routing-evidence finalization, turning a successful task into an error.
    • Fix: enforce the same maximum length in selector grammar/validation, or revise the invariant so accepted selectors cannot be rejected after execution.

This supplements the existing P1 provider-ID case-normalization finding. Overall verdict remains Request changes.

Yeachan-Heo and others added 25 commits August 20, 2026 05:21
AC13/D7 asked for a golden that actually runs the provider-order derivation. The
four existing fixtures hand the generator an already-sorted setup, so they only
ever proved that declaration order dominates tier order; none of them touch the
projection. This one starts from configured order plus catalog, runs the real
projection, and pins the resulting bytes.

It also pins the two behaviours that motivated the accessor: a configured
provider missing from the catalog is dropped before it can reach setup.providers
and pollute declarationFingerprint, and catalog order supplies the remainder.

Lore-id: 5ec1f0d3
Confidence: high
Scope-risk: narrow
Reversibility: clean
Tested: autorouting-generator 8 pass; removing the catalog-append branch from projectProviderOrder fails this fixture
Three gaps, all real. The selector check claimed to validate "every generated
tier selector" but tested three hardcoded strings and never touched
CURATED_TIER_MAP or the generator, so deleting the preset exhaustive loop
silently lost that coverage. It now walks every curated key and every selector
the generator actually emits from that catalog, with a negative control for
unfit selectors and an explicit note that a colon is legal inside a model id.

The accessor tests reimplemented the accessor body, so they could not catch a
regression inside it. The spelling-restore logic moved into
projectCatalogProviderOrder, which autoroutingProviderOrder now simply calls, and
the tests exercise that function directly. Real-instance tests remain for the
properties observable without global settings: no parameters, catalog-only
output, first-wins order, credential invariance, determinism.

Also proved the model-registry baseline claim instead of inheriting it: the same
four failures appear at HEAD and at pristine dev 178fc26, so they are
pre-existing and unrelated to autorouting.

Lore-id: 4f8ba7c1
Constraint: a test must fail when the behaviour it names is removed
Confidence: high
Scope-risk: narrow
Reversibility: clean
Tested: 57 pass across autorouting-provider-order, task-autorouting-redteam, autorouting-generator and smart-routing integration; removing the spelling restore fails 4 of them; model-registry failures diffed identical against pristine dev
…settings

The cleaner lane caught me repeating the exact mistake the terminal critic had
just corrected: the policy-derived golden rebuilt the catalog, spelling map, and
projection inline instead of calling projectCatalogProviderOrder, so it could not
fail if that function broke. It now calls the shipped function, which is what
ModelRegistry.autoroutingProviderOrder delegates to.

The real-registry suite also only assumed the global settings singleton was
uninitialized. A prior test setting modelProviderOrder would have silently
reordered the expected catalog projection and made those assertions accidental,
so the precondition is now reset around each test and asserted outright.

Lore-id: 6a4c0e93
Constraint: a golden must exercise shipped code, never a copy of it
Confidence: high
Scope-risk: narrow
Reversibility: clean
Tested: autorouting-generator 8 pass, autorouting-provider-order 19 pass; removing the spelling restore now fails 5 across both files where it previously failed 4, proving the golden is bound to the real function
…t rebase

Rebasing onto the current dev tip pulled in 44 new catalog keys the autorouting
tier map has never seen, so check:autorouting-map failed closed on uncurated
coverage. Record them as baseline skips with an explicit rationale rather than
inventing tier/rank data nobody reviewed.

Lore-id: 9d1f6b3a
Constraint: an uncurated catalog key is a skip with a rationale, never a guessed tier
Confidence: high
Scope-risk: narrow
Reversibility: clean
Tested: check-autorouting-tier-map gate passed (4264 in-scope keys); autorouting suites 98 pass
…lution

Removing the #writeTerminalBreadcrumb wrapper during the dev rebase left a double
blank line that check:tools rejects. Kept as its own commit rather than folded
into the regenerable telegram digest commit, which a later rebase skips and would
have discarded this fix with it.

Lore-id: 4e7a2b81
Confidence: high
Scope-risk: narrow
Reversibility: clean
Tested: biome check across 3714 files exits 0
Managed session opens must sanitize stale OpenAI Responses metadata in memory without appending durable patches. The autorouting selector must also tolerate minimal settings adapters while retaining its provider-order listener when available.\n\nLore-id: 4543-ci-fixforward-0647\nConstraint: preserve replay safety without rewriting managed transcripts on open\nTested: focused replay, onboarding, session-storage, model-selector, and daemon guard suites\nConfidence: high\nScope-risk: narrow\nReversibility: simple
The autorouting ACP fixture closed only its connection signal, leaving its session adapter alive while broker-root cleanup removed the fixture. Register and await the owned ACP session teardown before releasing the broker lease.\n\nLore-id: 4543-ci-fixforward-0647\nConstraint: fixture roots must remain absent after teardown\nTested: repeated fresh Bun ACP notice regression\nConfidence: high\nScope-risk: narrow\nReversibility: simple
Unpublished autorouting candidates must not replace the terminal continuation breadcrumb. Publish it only when a staged candidate is finalized; give the durable staged regression its required bounded test window.\n\nLore-id: 4543-ci-fixforward-0647\nConstraint: failed candidates leave no durable discovery residue\nTested: autorouting boundary and preflight regressions; coding-agent check\nConfidence: high\nScope-risk: narrow\nReversibility: simple
Current dev now includes the prior generation boundary, while autorouting still changes protected notification lifecycle code. Regenerate the complete guard-owned authority set atomically.\n\nLore-id: 4543-ci-fixforward-0647\nTested: telegram guard, topic registry, and focused routing/session suites\nConfidence: high\nScope-risk: narrow\nReversibility: simple
SDK patches and config CLI writes could bypass nested autorouting validation, while task creation prefiltered credential failures as recoverable absences.\n\nValidate typed autorouting objects at every mutation ingress and leave credential classification to executor preflight so unexpected lookup faults fail closed.\n\nLore-id: pr4543-fixforward\nConstraint: preserve owner-controlled Draft state\nConfidence: high\nScope-risk: focused\nReversibility: revertable\nTested: focused autorouting ingress and preflight suites
Autorouting preflight resolved exact keys against the execution session instead of the distinct credential session.\n\nUse the propagated credential session identity so managed credentials remain available to pinned candidates.\n\nLore-id: pr4543-credential-scope\nConstraint: preserve fail-closed autorouting preflight\nConfidence: high\nScope-risk: focused\nReversibility: revertable\nTested: task-autorouting-preflight
Reject malformed autorouting tier maps before SDK config.patch persists them.\n\nTested: autorouting-settings-contract
Keep truthful missing-credential skips while propagating unexpected lookup errors and using the credential session scope.\n\nTested: autorouting boundary and preflight suites
Defer unexpected TaskTool credential probe failures to executor preflight so routing receipts remain fail-closed and auditable.\n\nTested: autorouting preflight, integration, boundary suites
Root TypeScript validation requires the optional credential session argument to exclude null.\n\nTested: ci-dev-affected root-check
Carry TaskTool credential lookup exceptions into the authoritative preflight ledger instead of retrying and losing one-shot failures.\n\nTested: routing preflight, integration, and boundary suites
Ensure TaskTool transfers an observed credential lookup fault into executor preflight without retrying it.\n\nTested: routing preflight, integration, boundary suites
Use Map presence rather than value truthiness so every captured JavaScript throw reaches terminal preflight evidence.\n\nTested: routing preflight, integration, boundary suites
…ent dev

Reconciliation of the transplanted autorouting branch onto dev 02c739e:
the telegram semantic manifest digests and DAEMON_GENERATION are regenerated
atomically via the canonical --fix-generations tool (170 -> 171), and the
topic-registry pin is re-synced, exactly as previous rebases of this series did.
…nsensitively

Review P1: task.autorouting.setup accepts provider ids in arbitrary casing,
but tier generation matched provider prefixes and catalog keys with exact
case-sensitive startsWith, so a hand-edited providers: ["OpenAI"] against
openai/... keys silently produced empty fast/balanced/strong tiers while
autorouting stayed enabled. Comparison now normalizes both sides while
persistence keeps catalog spelling, and provider de-duplication plus the
allowlist run on normalized ids so two spellings of one provider cannot
double-declare or filter past each other.

Lore-id: a7c3e1f2
Constraint: selectors must stay catalog-spelled in persisted tiers
Tested: mixed-case setup/allowlist/dedup generator regressions
Confidence: high
Scope-risk: narrow
Reversibility: trivial
Review P2: AUTOROUTING_SELECTOR_PATTERN accepted arbitrarily long model ids
while assertRoutingEvidenceInvariant rejects an effectiveModel or
requestedSelector longer than 256 characters, so a routed custom model id
could execute successfully and then fail during routing-evidence
finalization. The shared AUTOROUTING_SELECTOR_MAX_LENGTH constant now
enforces the same bound at validation time, so no accepted selector can be
rejected after execution.

Lore-id: b8d4f2a3
Constraint: invariant in task/types.ts and grammar must share one bound
Tested: over-long selector rejected at config time; 200-char accepted
Confidence: high
Scope-risk: narrow
Reversibility: trivial
…card

Review P1: the managed durable preflight adopted its attempt staging twice --
once inside ManagedTaskPersistence.openStagedSession() and again through the
generic preflightDurable branch in runSubprocessOnce -- leaving the first
manager unreachable from commit/discard so managed autorouting retries could
orphan staging roots. Generic adoption is now conditional on
!options.managedPersistence, and commitStaged/discardStaged fail closed when
a staging manager with a foreign attempt id was adopted over the
publication's own root.

Lore-id: c9e5a3b4
Constraint: fail closed, never silently skip, on root mismatch
Tested: double-root commit and discard regressions; single-root lifecycle
Confidence: high
Scope-risk: moderate
Reversibility: moderate
…keys

Review P2: the tier-map gate accepted skip entries with empty rationales,
malformed keys, out-of-catalog keys, and keys that were both labeled and
skipped, so future catalog additions could bypass curation behind a stale
skip entry. The gate now enforces selector grammar, non-empty rationale,
catalog scope, and label/skip exclusivity, which surfaced five genuinely dead
baseline keys (lowercase minimax-m3 spellings plus a nonexistent minimax-v3)
that are removed rather than carried as permanent skips.

Lore-id: d0f6b4c5
Tested: four new gate rejection cases; gate green at 4272 in-scope keys
Confidence: high
Scope-risk: narrow
Reversibility: trivial
…contracts

The boundary red-team suite pinned the old contract where an over-long tier
selector produced no local validation issue and only the executor's evidence
bounding stood between it and finalization. With the grammar now capped at
the routing-evidence bound, the over-long entry fails closed at validation
time, so the hostile-selector case asserts the early rejection while the
control-only/traversal/homoglyph shapes still flow to executor sanitization,
and the shared skip-projection case stays under the grammar bound so the
16/4 aggregation remains the exercised bound.

Lore-id: e1a8c5d6
Tested: autorouting-boundary-redteam 41 pass
Confidence: high
Scope-risk: narrow
Reversibility: trivial
…ants

Independent-review hardening (architect approve, zero P1s, three
recommendations applied):

- AUTOROUTING_SELECTOR_MAX_LENGTH is now imported and reused by the
  routing-evidence invariant (task/types.ts), the receipt bounding
  (task/receipt.ts), and executor boundedSelector, so the grammar and
  every post-execution bound share one constant by reference instead of
  four coincidental 256 literals.
- commitStaged/discardStaged require strict attempt-root equality while a
  staged publication is uncommitted: an adopted manager that is absent or
  foreign fails closed, closing the released/id-less adoption hole.
- the tier-map gate reports both-labeled-and-skipped keys as invalid skips
  (matching its remediation text) instead of folding them into stale skips.

Lore-id: f2b9c6d7
Tested: tier-map gate green (4272 in-scope, 3927 baseline); gate/preflight/settings suites 52 pass
Confidence: high
Scope-risk: narrow
Reversibility: trivial

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd48850135

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1803 to +1807
: sessionFile
? await awaitAbortable(
SessionManager.openStaged(sessionFile, undefined, options.autoroutingAttemptId ?? id),
)
: SessionManager.inMemory(worktree ?? cwd)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Support durable preflight when no child session file exists

When an ordinary synchronous Task run has neither managedPersistence nor an explicit child sessionFile, this branch creates an in-memory manager for the durable attempt. After the probe succeeds, publishPostFence() unconditionally calls openedSessionManager.commitStaged(), but an in-memory manager has no staged publication and throws Staged session is unavailable; consequently every otherwise valid autorouted task in this common configuration fails before its first provider request. Use a staged-capable manager here or provide a separate artifact-only acceptance path for sessionless runs.

Useful? React with 👍 / 👎.

Comment on lines +2061 to +2064
const model = routingSnapshot.find(
candidate =>
candidate.provider.toLowerCase() === provider &&
(modelId === candidate.id || modelId.startsWith(`${candidate.id}:`)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match literal colon-bearing model IDs before suffix variants

For a configured literal selector such as openrouter/openai/gpt-4o:extended, when the snapshot also contains openrouter/openai/gpt-4o earlier, this predicate selects the base model because modelId.startsWith(candidate.id + ":") succeeds before the exact literal entry is examined. Since getApiKey() receives the selected model ID and supports model-specific credential selection, the literal candidate can be incorrectly classified as credential_unavailable even though its own credential exists. Prefer an exact model-ID pass before treating a trailing colon segment as a thinking suffix.

Useful? React with 👍 / 👎.

@probepark probepark left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at exact head cd488501approved, with a required changelog cleanup.

coverage of this verdict, stated up front

71 files is more than anyone reviews line by line, so here is what this approval actually covers.

Reviewed closely: autorouting-contract.ts, autorouting-generator.ts, autorouting.ts, provider-selection-policy.ts/model-registry.ts, task/index.ts, task/executor.ts, the smart-routing controller and panel, routing status/evidence, and the staged-session commit seams.

Not reviewed line by line: the ~6,000-line curated tier-label/skip dataset, individual goldens, generated schema/catalog/inventory payloads, and peripheral artifact/session refactors outside the staged preflight commit/discard invariants. Those were sampled for contract consistency.

Split: 46 production/build/generated, 23 test (5 goldens), 2 docs/changelog.

what breaks

task.autorouting.preset is removed, so preset-only configs fall back to manual routing until tiers are generated. Public TS drops AutoroutingEffective.source, RoutingOutcome.source, AUTOROUTING_PRESETS, AutoroutingPresetId, resolveTierMap and TaskRoutingEvidence.source. Routing note formats and /routing status provenance labels change.

All of that is described in the body, docs/tools/task.md, and the changelog text — a ! change whose break is documented, which is the bar.

the trust question

Autorouting picking a provider automatically is the thing to get right, so:

  • Off by default.
  • Tier generation is pure over explicit setup plus catalog and structurally does not read auth.
  • Applying generated tiers is an explicit panel action, with providers and resulting chains shown first.
  • Execution filters disabled/missing models and resolves credentials through the parent ModelRegistry/AuthStorage and parent credential-session identity — no new credential or endpoint discovery source.
  • The probe stops at the preflight-accepted fence before sending task data, and the durable attempt commits at that fence.

Failure behavior is bounded rather than strict: missing credentials may advance to at most three declared candidates, while unexpected auth/keychain errors, non-transient setup errors, cleanup uncertainty and every post-fence failure stop instead of switching providers. Invalid or absent policy falls back to the user's existing manual chain with a warning and status.

That is not abort-on-misconfiguration, but it is documented, observable, and bounded to the user's own pre-existing chain rather than an undeclared provider. Effective model, skips, attempts, fallback reason and terminal outcome are persisted and rendered.

Public surface unchanged: four skills, four role agents.

minor — literal-first selector matching is violated in the credential prefilter

task/index.ts:2062-2067 combines exact and startsWith(candidate.id + ":") matching in one find(), so a literal colon-bearing model ID can resolve against a shorter prefix model. That conflicts with normalizeTierSelector's literal-first contract and can skip a usable hand-authored route or probe the wrong model's credential context.

Match the exact ID first, then parse only a supported thinking suffix and match its base. Worth a regression with catalog order [provider/foo, provider/foo:variant] and a tier selecting the variant.

required before merge — the changelog has committed merge debris

Not blocking under the maintainer's raised threshold, but it must not ship:

2197:||||||| parent of c6f40d64dc (feat(task): add opt-in sub-agent model autorouting)
3638:||||||| parent of 74fccc7eff (feat(task): auto-generate autorouting tiers from declared providers)

Two diff3 conflict markers are committed. The autorouting entry is also duplicated verbatim at lines 256 and 417, and the breaking notes sit under released ## [0.14.0] - 2026-08-17 (line 72) rather than Unreleased.

Being straight about my own consistency: I blocked #4617 on exactly the released-section placement. The threshold has since been raised to behavioral harm, so I am approving and flagging instead — but a shipped release advertising features it never contained is still wrong, and conflict markers in a user-facing file are unambiguous debris. Please move the four entries to Unreleased and strip the markers and duplication.

Reviewed by @probepark — method: detached worktree at cd488501, mapped the diff by directory before reading code to isolate decision logic from surface, traced the routing decision path end to end including credential resolution and the preflight fence, verified the break list against body/docs/changelog, and grepped the changelog for merge debris. Tests not executed.

gajae.pr-review-verdict.v1 merge-approved sha256:bdb921ce0871e6ea432d22ec6998281159b632efa8f09e0dda2f8eebd22bc9eb reviewer:human reviewer-id:probepark evidence:exact-head-cd488501-routing-is-opt-in-explicitly-applied-and-adds-no-credential-source-changelog-debris-flagged

@snowykr snowykr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

CHANGES_REQUESTED

Summary

The five-axis review completed against the exact head and identified 6 actionable issues, led by Generated selectors can bypass the published length contract and Schema omits selector length limit. These findings require changes before approval.

Findings / Required Changes

  1. [P1] Generated selectors can bypass the published length contract.
    Reference: packages/coding-agent/src/config/autorouting-generator.ts:127-133
    selectorWithEffort validates only the regex, while isValidAutoroutingSelector enforces the 256-character limit; custom catalog model IDs can therefore be generated and persisted beyond the runtime contract, then fail normalization and silently fall back. Enforce the shared validator during generation or reject overlong catalog selectors before materializing tiers.
  2. [P1] Schema omits selector length limit.
    Reference: schemas/config.schema.json:1060-1215
    Runtime validation caps selectors at 256 characters, but the generated JSON Schema exposes only the pattern, so external validators accept configurations runtime rejects. Add maxLength: 256 to every selector schema and regenerate the schema.
  3. [P2] Autorouting selector validation permits control characters.
    Reference: packages/coding-agent/src/config/autorouting-contract.ts:113-122
    the selector regex excludes whitespace and globs but not C0/C1 control bytes, so malformed provider/model values can pass local validation and reach routing when a matching catalog entry exists. Reject control characters in the shared validator and generated JSON schema before configuration or execution.
  4. [P2] Multimodal models are incorrectly excluded from autorouting.
    Reference: packages/coding-agent/scripts/check-autorouting-tier-map.ts:37-49
    isImageGenerationOnly returns true for any model whose output includes image, including models that also support text. This removes them from the curation gate and generated tiers. Restrict the exclusion to image-only models (or explicitly document and test the intended policy).
  5. [P2] Routing summary attributes allow control characters.
    Reference: packages/coding-agent/src/task/index.ts:1680-1700
    projectRoutingForSummary escapes XML metacharacters but not control characters or Unicode line separators, while effectiveModel and note are provider/diagnostic data rendered with noEscape. Sanitize or reject non-XML-safe characters before interpolation.
  6. [P2] Sanitize routing evidence before XML interpolation.
    Reference: packages/coding-agent/src/task/index.ts:492-500
    projectRoutingForSummary only XML-escapes &, <, >, quotes, and apostrophes, while TaskRoutingEvidence accepts control characters in effectiveModel and note. Provider- or config-controlled CR/LF/control bytes can therefore enter the noEscape task-summary attributes and alter prompt structure. Apply single-line/control-character sanitization before escapeXmlAttribute and validate the sanitized bounded values.

CI / Verification

  • Reviewed the exact remote head: cd48850135c1b1f7072583dc227346b94b3c6367.
  • CI summary: 69 passing, 4 failing, 5 pending/cancelled/skipped.
  • Failing checks: Affected path validation, Affected path validation / evidence producer, Affected path validation / test:@gajae-code/ai, Windows dev:doctor + session-path regression.
  • Non-successful checks without pass evidence: Virtual integration validation, Windows native build toolchain path, Validate exact-head PR contract, Affected path validation / ${{ matrix.key }}, Live deployed release state.
  • Passing evidence reviewed: Affected path validation / cargo-build:cargo:cGktc2hlbGw:Y3JhdGVzL3BpLXNoZWxsL0NhcmdvLnRvbWw, Affected path validation / cargo-build:cargo:cGktbmF0aXZlcw:Y3JhdGVzL3BpLW5hdGl2ZXMvQ2FyZ28udG9tbA, Affected path validation / cargo-build:cargo:cGktaXNv:Y3JhdGVzL3BpLWlzby9DYXJnby50b21s, Affected path validation / cargo-build:cargo:cGktYXN0:Y3JhdGVzL3BpLWFzdC9DYXJnby50b21s, Affected path validation / cargo-build:cargo:Z2pjLXNkaw:Y3JhdGVzL2dqYy1zZGsvQ2FyZ28udG9tbA, Affected path validation / ts-build:ts:c3RhdHM:cGFja2FnZXMvc3RhdHM, Affected path validation / ts-build:ts:Y29kaW5nLWFnZW50:cGFja2FnZXMvY29kaW5nLWFnZW50, Affected path validation / test:packages/coding-agent/test/session-manager-resident-cache.test.ts.
  • Repository policy permits review before all gating checks pass; the current non-passing checks are recorded above and do not establish that checks passed.

Axis Coverage

Axis Verdict Coverage
A1. Intent / Policy / Contract CHANGES_REQUESTED Autorouting boundaries are mostly explicit and fail-closed, but schema/runtime length drift and unsanitized noEscape summary attributes leave compatibility and trust risks.
A2. Architecture / Correctness / Failure CHANGES_REQUESTED A2 correctness is mostly structured and staged, but generated-selector validation can diverge from runtime limits and malformed control-bearing selectors remain admissible.
A3. Security / Privacy / Trust CHANGES_REQUESTED Autorouting credential-independence and staged-attempt boundaries were reviewed; routing summary attributes remain vulnerable to control-character prompt-boundary injection.
A4. Verification / Tests / CI APPROVED A4/A5: targeted autorouting verification passed, while unresolved aggregate and Windows CI failures leave observable-regression risk untriaged.
A5. Context / Compatibility / Platform CHANGES_REQUESTED Integration and documentation contracts are largely covered, but multimodal catalog scope and currently failing AI/Windows validation leave compatibility risk.

Limitations

  • CI reports @gajae-code/ai test failure and Windows dev:doctor + session-path regression failure, so cross-package AI and Windows platform compatibility cannot be claimed as passing; virtual integration validation was skipped.
  • Windows dev doctor/session-path validation failed, limiting cross-platform compatibility confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants