Skip to content

fix: put an unpinned Jev tier back on the session's own model - #12872

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/jev-model-route-ratchet
Sep 23, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/jev-model-route-ratchet

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What

A Jev-routed turn switched the live session onto the answered tier's model and nothing put it back. An UNPINNED tier applies nothing, so on a partially pinned tier map the first answered pinned tier captured the session for the rest of its life:

  1. "rename this variable" → simple → pinned to the cheap model → session moves there.
  2. "redesign the scheduler" → complex → unpinned → applies nothing → still on the cheap model.

Every install is on that path: all three tiers ship as "" (no model id may be hardcoded as a default), so an owner pins one tier first. The owner's configured model was then never reached again for the life of that session, and turn two's own receipt named the cheap model as its baseline_model — the strip captions that field "Model without routing".

Two changes, both in _route_model_for_turn:

  • An unpinned tier switches BACK to the model the session ran on before routing first moved it, through the same resolve_substitute_set_model seam and under the same two locks a pin uses. The receipt still says the tier applied nothing, because it did: model_chosen stays UNPINNED, and applied / model_used are written for a pin only — a pair of fields saying whether a switch took would report a switch the row itself says was never asked for.
  • baseline_model is that pre-route model on every turn, latched on the slot at the first routed turn (_jev_route_baseline). Read off the live session it was the previous turn's tier from turn two on, which is how the dearest turn of a conversation came to claim the cheapest model as its own default.

The bug lives entirely in the live session plus the served_model cache — slot.model stays auto throughout and is untouched here.

Why these edges

  • Nothing to go back to → no switch, which is the outcome every refusal already has: an unlatched baseline, a session already on it, a "" baseline (the backend never named the session's model, so no id a set_model could ask for), or no switch seam at all. A failed restore records the ordinary unpinned outcome row rather than an error category, because no tier model was dropped.
  • An explicit pick by hand re-latches the baseline. The slot's pick generation moving is the signal — the same one the fallback restore probe reads — so a restore never puts the session back on a model the owner has deliberately left.
  • The re-pick guard inside the locks now compares the LIVE model, not baseline_model. Those were one value before and differ from the second routed turn on; comparing the baseline would drop every later turn as a phantom re-pick.
  • Not persisted, for the reason jev_route is not: it describes one live session, and a respawned session latches afresh on its first routed turn.

_default_session_model is deliberately not the source of the restore target: a routed slot holds slot.model == "auto", and that helper returns "" for any slot whose model is set, so it names nothing for exactly the slots that route.

Tested

  • test/test_decisions_model_route_ratchet.py — new, 4 tests. It landed as a green repro of the leak (turn two reports baseline_model=cheap and stays on the cheap model); the assertions are inverted here, plus a third turn routing from the base model again, a session whose served model the backend never named, and a hand pick becoming the new baseline. Its client double is what makes any of this observable: served_model FOLLOWS set_model, where the apply suite's fixed-attribute double cannot show a second turn at all.
  • test/test_decisions_model_route_apply.py — 31 passed unchanged, including test_the_shipped_unpinned_map_switches_nothing_but_still_reports (a never-routed slot has no baseline to return to, so no set_model is attempted) and the manual-pick-during-the-await pair.
  • test_decisions_model_route.py, test_decisions_strip_rides_message.py, test_dashboard_state_ws.py: 193 passed together.
  • mypy src/kiro_crew clean, flake8 clean, black --check clean on the touched files, scripts/docs-lint.sh passed.
  • scripts/local-gate.py: no failure in any chat, slot or decisions suite. The reds it reports are host/main-side and untouched by this diff (test_acp_runtime.py under parallel load, test_cron_timezone_display.py host-TZ, test_autonudge_reconciler.py collection errors).

Specs updated in the same commit: section 11 of docs/system-specs/modules/decisions.md, and the one user-facing sentence in src/kiro_crew/docs/decisions.md that said an empty level "just runs on the model the chat was already using".

Pattern harvest

Rule candidate: review-prompt

Pattern: a per-turn apply whose apply is CONDITIONAL and whose restore does not exist. The condition holds on one turn and not the next, so the applied value is one-way: whatever the last satisfied condition wrote stays written for the life of the session. Here the condition is "this tier is pinned" and the value is the live session's model, so one cheap turn captured every later one. The reviewer question is the one this PR could not answer from the code: when this branch does not fire, who puts the value back? A conditional apply needs a restore arm or an explicit statement that the value is meant to persist — "the point runs again next turn" is not that statement, because the next run can decline to act.

Secondary, and the reason the receipt lied as well as the session: a function that READS a field as its input and WRITES the same field as its output is self-aliasing across invocations. slot.served_model was turn N's output and turn N+1's baseline_model input, so "what would this turn have run on without routing" answered with the previous routing's result. The fix is the general one: latch the pre-state ONCE, before the first write, and read the latch — never the live field — for any "what would have happened" claim. Worth a reviewer prompt on any before/after, baseline, delta or savings figure computed from a field the same code path mutates. Sibling seams in this module already carry the latch (_fallback_primary_model, _fallback_slot_model) plus a staleness signal for a value the owner has since changed by hand (_model_pick_gen), which is what this fix reuses rather than inventing.

Not a semgrep shape: both are data-flow questions spanning two invocations of one function, with the state living on an object between them. A matcher would either miss the aliasing or flag every read-then-write of a cached field.

@iamwhatever
iamwhatever requested review from a team and hoang-phan98 September 22, 2026 17:43
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 111ce3726307cdb1469b1af6940ee91b83f90d45 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Confirm the old spec's "a routed turn is NOT reverted" sentence was a rationalized defect, not a product decision — this PR inverts a documented deliberate behavior.

Suggestions

  • The pinning test the description cites (test_the_shipped_unpinned_map_switches_nothing_but_still_reports) now passes only because a never-routed slot has no latch; add one assertion in the new suite naming that distinction so a future refactor of the latch doesn't silently widen "switches nothing" back into the ratchet.

[DESIGN-REVIEWED] 111ce37

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 111ce3726307cdb1469b1af6940ee91b83f90d45 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 111ce37

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 111ce3726307cdb1469b1af6940ee91b83f90d45: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 111ce3726307cdb1469b1af6940ee91b83f90d45 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The description says applied/model_used are "written for a pin only"; the diff writes both on every restore row, and the new tests pin exactly that.

Not justified as shipped

  • Item 3 — undeclared: the description's "applied / model_used are written for a pin only — a pair … would report a switch the row itself says was never asked for" is contradicted by the diff (routed["applied"] = _used == _target or _used != _live_model on the restore path, applied=False on a failed restore) and by test_a_restore_that_does_not_take_says_so_on_the_row; the same pre-fix semantics also survive in decisions.md's unchanged collapsed-line paragraph, which still says baseline "is the PREVIOUS turn's tier rather than a pin, so a caption … named a 'default' that changed every turn" — a rationale this diff removes.
    Subtraction: delete that stale clause from docs/system-specs/modules/decisions.md (the "changed every turn" rationale); the baseline no longer changes per turn.
    Clears when: the PR description and that decisions.md paragraph both state the shipped row semantics the tests pin.
  • Item 4 — undeclared: the fallback interplay (_active_fallback, restore suppressed while a throttle/refusal fallback serves the session, baseline latched from the replaced primary) appears nowhere in the description's "Why these edges".

What this change ships

Inventory (8 items) — 6 justified

Intent: FIX — a routed turn moved the live session onto a pinned tier's model and nothing put it back, so a partially pinned map captured the session and the receipt's "Model without routing" named the previous tier.

  1. An unpinned tier now moves the chat back to the model it ran on before routing first moved it — justified
  2. The receipt's "Model without routing" names that pre-route model on every turn, latched once per wire session across chat aliases — justified
  3. A restore row now carries applied/model_used, and a failed restore writes an ordinary row with applied: false — undeclared: the description states the pair stays pin-only
  4. While a throttle or refusal fallback serves the session, no restore is attempted and the baseline names the replaced primary — undeclared: never mentioned in the description
  5. A model picked by hand — through any alias, even during the routing round trip — becomes the new baseline and is never reverted — justified
  6. The mid-question re-pick guard compares the live model plus the shared pick epoch instead of the receipt's baseline — justified
  7. Spec section 11 and the user-doc sentence updated in the same commit — justified
  8. New 16-test suite whose assertions fail on base (the leak repro) — justified

[FIRST-PRINCIPLES-REVIEWED] 111ce37

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 58e090218b415db40874c630940d3f527b15c648 — this comment is updated in place on each push.

Review details

I've traced the single candidate. The claim is that the set_model_fn is None + not _chosen branch (chat_runner.py:4487+) omits applied/model_used, so a stuck restore reads as healthy.

Falsifying reachability (requirement (a) — a concrete input that occurs in practice):

  • To reach that branch, _target must be truthy while _chosen is empty, i.e. _restore_to (=_baseline) is non-empty, meaning _baseline != _live_model.
  • _jev_route_baseline sets baseline = _fallback_primary or live_model. On the first routed turn with no fallback, _fallback_primary == "", so baseline == live_model → _restore_to == "". When a fallback is active on the first turn, _active_fallback(...)[0] is True → _restore_to is forced to "". So _restore_to is non-empty ONLY on a later turn whose latched baseline differs from the current live model.
  • The live model diverges from the latched baseline only because a prior routed turn applied a pin via set_model_fn, or a sibling alias did (explicit picks bump the epoch and re-latch fresh; respawns change the session id and re-latch; fallback is excluded above). Every one of those paths required resolve_substitute_set_model(client) to return a callable.
  • That function's result is a structural property of the client object — provider.set_model (or its inner client's) being callable — with no dependence on transient session state. A client that had the seam on an earlier turn still has it now (same client object; cross-alias shares the same client). So set_model_fn is None cannot co-occur with a non-empty _restore_to.

(a) comes out as "could not construct" — the candidate itself rates reachability "low" and I cannot re-derive a concrete input at 80+. It dies under falsification.

No further grounded defect surfaced while tracing.

No findings.

[OPUS-REVIEWED] 58e0902

Verdict parsed from the review's SHA-scoped output markers for commit 58e090218b415db40874c630940d3f527b15c648.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 58e090218b415db40874c630940d3f527b15c648: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 22, 2026
@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from 148e9d2 to ccbc5de Compare September 22, 2026 18:12
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Fixed in ccbc5ded12 (squashed + rebased onto 64f3b58119), not disputed.

F1 — cross-alias pick invalidation. Upheld and taken. The latch now reads BOTH pick signals, the same pair _probe_fallback_restore_for_slot_locked reads: this slot's _model_pick_gen, and the shared _explicit_pick_epoch off pick_epoch_host(client), compared only when both values are real integers (an epoch host carrying no integer epoch is no comparable cross-alias signal, which is the sibling's own rule).

Two things came with it, both named in the fix line:

  • The live model is re-read before the latch is taken. A cross-alias pick leaves THIS slot's served_model cache naming the model the owner left, so latching it would have reproduced the same defect one turn later. _jev_route_baseline now returns (live, baseline) from one call, and the hook no longer reads the slot cache itself.
  • The record drops on session teardown, added to _ChatSlot.forget_session_model_state — the single funnel every teardown site calls — so a respawned session cannot inherit a model the torn-down one served.

Both halves are revert-verified: with the epoch comparison removed, and with the live re-read removed, test_a_pick_through_another_alias_becomes_the_new_baseline fails; restored, 37 pass. That test runs the second turn on a WARM session (get_or_create returning is_new=False), because the runner syncs the served model only for a fresh or reloaded one — a fresh-every-turn double hides the stale cache and made the first version of the test vacuous on the re-read.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for ccbc5ded12d2c2738c7b8ef0a5fa343d8e69f27b; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ccbc5ded12d2c2738c7b8ef0a5fa343d8e69f27b: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from ccbc5de to 75e2f43 Compare September 22, 2026 21:50
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Both blocking findings upheld and fixed in 75e2f432d6 (amended single commit, rebased onto b35a866d85). The root was one thing: I kept a SESSION fact in a per-slot field.

GPT F1 / Opus BLOCKING — the baseline now lives on the session, not the slot. _jev_route_baseline stores one attribute on pick_epoch_host(client), the same host the explicit-pick epoch lives on, carrying (session id, model, pick epoch). Several slot aliases drive one wire session, and each alias's served_model is only that alias's cache of the session's answer — latched per slot, alias B took alias A's routed model as its own baseline and no alias could put the session back.

The alias cache is re-read from the live session on every routed turn, not on a signal. A routed turn through a sibling alias moves the session's model and bumps no counter at all, so there is nothing to gate the read on. This is the half of F1 that made B skip restoration: B's cache and the baseline were stale-equal, so _target came out "".

Opus's absent-epoch case is closed by comparing the stored epoch for EQUALITY rather than with an isinstance pair-test: the record keeps what it read, so absent-vs-1 is a move and the latch is re-taken. The read's 0 default is kept for parity with the fallback restore probe; on its own it is not a second mechanism, and I am not claiming it as one.

Opus FINDING — the in-lock guard re-reads the shared epoch beside the flag and the live model, since a cross-alias pick landing inside the decide round trip leaves this slot's cache untouched. Same window the fallback restore probe closes at _probe_fallback_restore_for_slot_locked.

A pooled runtime claimed for a new session is covered by the session id in the record, so a reused host cannot hand the next session the previous one's baseline. The per-slot fields and their teardown hook are gone — state.py is untouched by this PR now.

Revert-verified, five mutations, each breaking a different test: latch moved back onto the slot (4 tests fail), live re-read removed, in-lock epoch re-read removed, session id dropped from the record, epoch dropped from the record. Restored tree: 38 pass. The sibling-alias test runs alias B's turn on a WARM session (get_or_create returning is_new=False) and gives B the cache its own session start would leave — a fresh-every-turn double, or a B whose cache differs from the baseline, hides the defect entirely, which is how my first version of that test passed while the bug was still there.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from 75e2f43 to 1092f51 Compare September 22, 2026 22:30
@iamwhatever

Copy link
Copy Markdown
Contributor Author

F1 upheld and fixed in the amended commit. The asymmetry was mine: before this PR an unpinned tier attempted no switch, so a row silent about applied was honest. Now it can attempt a restore, and the reader takes an absent applied as applied — so a restore that did not take published a healthy receipt for a turn still running on the previous tier's model.

One formula for both switch kinds. applied and model_used are now written whenever a switch was attempted, measured against _target — the model THIS turn asked for, which is the tier's pin on a pinned turn and the baseline on an unpinned one. A pinned turn behaves exactly as before, because _target == _chosen there.

The raising arm carries the verdict too. A restore that raises records model_used (the model the turn ran on) and applied: false on the ordinary outcome row. It stays an outcome rather than an error category, because no tier model was asked for: an error row would name a tier that was never switched to and the strip would report a dropped answer.

A row that attempted NOTHING — no baseline latched, the session already on it, a baseline the backend never named — still carries neither field, which is the honest absence.

No frontend change: decisionRecord.ts already reads applied: root.applied !== false and DecisionStrip.tsx already names modelUsed || baseline in the "did not take" line, so a failed restore renders as "complex → (unpinned) … did not take, ran on <model>". The spec sentence about the two fields now says they describe the switch that row's turn asked for.

Two new tests: a restore the provider accepts and ignores (the ladder-exhaustion shape), and one it refuses outright. Both assert applied is False and model_used naming the model the turn actually ran on; the raising one also asserts no error category.

Revert-verified, seven mutations. Six break a test: the latch moved onto the slot, the live re-read removed, the in-lock epoch re-read removed, the session id dropped from the record, the epoch dropped from the record, and the raising arm left silent. The seventh — measuring applied against _chosen instead of _target — is NOT load-bearing and I am not claiming it: for a restore the "moved off where the turn started" clause already decides, and _target != _chosen with the first clause deciding is unreachable. _target is kept as the honest spelling of what the row is about. Restored tree: 40 pass.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 1092f51edd585d745e85c4f87d02ec540bb13a85; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 1092f51edd585d745e85c4f87d02ec540bb13a85: <one-sentence reason>

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from 1092f51 to 1887fea Compare September 22, 2026 23:01
@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from a7a6519 to 58e0902 Compare September 23, 2026 01:09
@iamwhatever

Copy link
Copy Markdown
Contributor Author

F1 upheld and fixed. Same class as the earlier rounds, and this closes the enumeration: fallback activity was read from ONE slot's sticky copy while the fact belongs to the session.

Both reads now take the shared provider marker first. _active_fallback(slot, client) returns (active, primary) from llm_helpers.TURN_FALLBACK_ATTR via provider_fallback_active, and consults the slot's _active_fallback_model / _fallback_primary_model only after it — the two are one record that _clear_fallback_sticky_state drops together, but only the marker is visible to an alias that did not take the swap. The latch value and the restore suppression both go through that one reader.

A marker that names no primary latches nothing. Returning (True, "") means the session is served by a substitute and nothing names what it left; writing the live model there would make the substitute the durable baseline, which is the defect the branch exists to prevent. The record is skipped and the next turn takes it once the ladder is done. The receipt still names the model the turn ran on rather than inventing a default.

Four movers, all read from the session now: an explicit pick (the shared _explicit_pick_epoch), a Jev route (this function), a session respawn (the session id in the record), and the fallback ladder (the shared marker).

Three new tests, each driven through the real hook with the sticky fields left OFF the acting slot — which is what a sibling alias has: the latch takes the primary, the unpinned turn attempts no restore, and an unnameable primary writes no record. One of them needed its assertion fixed rather than the code: hasattr on the stub epoch host answers true for every name, so "nothing was latched" is asserted on the record's shape.

Ten mutations revert-verified, each breaking at least one test: fallback activity read per slot, an unnameable primary latching the substitute, the substitute latched as the baseline, a restore firing during the ladder, the latch moved onto the slot, the live re-read removed, the in-lock epoch re-read removed, the session id dropped from the record, the epoch dropped from the record, and the raising arm left silent. Restored tree: 45 pass in the two routing suites.

Rebased onto 80532c1a1e, which carries #12943 — that is the main-side test_crew_log_exc_info_sites failure on crew_store.py that was red on shard 7 here and on every other PR; it is not this diff and it is already fixed upstream. flake8, black, mypy, comment-history and docs-lint clean; the spec says which record each read comes from.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from 58e0902 to ece5024 Compare September 23, 2026 06:03
@iamwhatever

Copy link
Copy Markdown
Contributor Author

F1 upheld and fixed: _active_fallback reads the refusal record first (slot._refusal_fallback_primary), then the shared throttle marker, then that alias's sticky copy. The refusal record already folds a throttle primary into itself at swap time, so reading it first names the owner's model even when both substitutions happened.

Why not "read the configured pin instead of latching runtime state". It cannot fire: a routed slot has no pin by construction. _jev_route_armed is exactly "the owner named no model" — the picker writes slot.model = "auto" when it arms routing, any concrete pick clears jev_route, and the implicit arm requires model in ("", "auto"). So a pin-first read is dead code on every routed slot and removes none of the reads it would sit above. The set it has to cover is closed differently: the writers of set_model on a live session, which are the pick handler, the throttle swap/restore, the refusal swap/restore, this routing hook, and session creation. All five are now accounted for, and the substitution half is behind one predicate, so a future sixth writer is one reader to update rather than three.

Comment surgery, no behaviour in it. _jev_route_baseline's docstring is 45 lines down to 8 (the latch host, the invalidation triple, the substitution rule); _active_fallback's is 14 down to 3; the module constant's 7-line comment is gone (it restated the docstring); the try/except Exception # pragma: no cover around the setattr is gone and the baseline read moved INSIDE the existing try, so a host that refuses the attribute leaves the turn unrouted — the refusal this function already documents — instead of needing a guard of its own. The spec paragraph went from 585 words and 8 rules to 198 words and the 3 that bind a reader.

Eleven mutations revert-verified, each breaking at least one test, the two new ones included: the refusal record unread (2 fail), the throttle marker read per slot only (3), an unnameable primary latching the substitute, the substitute latched as the baseline (5), a restore firing during a substitution (3), the latch moved onto the slot (6), the live re-read removed, the in-lock epoch re-read removed, the session id dropped, the epoch dropped, the raising arm left silent. Restored: 47 pass.

One note on the new tests, which is the third time this shape has bitten me here: the stub epoch host answers EVERY attribute, so _explicit_pick_epoch reads as a moved pick and the refusal restore drops its record before the routing hook ever runs. Both tests pin the host epoch and the slot's snapshot equal, and script a set_model that refuses the primary — the restore then fails and keeps the record, which is the only state in which the finding's window is open.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
A routed turn switches the live session onto the answered tier's model and
nothing puts it back, so on a PARTIALLY pinned tier map -- which is what
every install is on the way to, since all three tiers ship empty -- the
first answered pinned tier captures the session for the rest of its life.
A one-line rename answered `simple` moves the chat to the cheap pin; the
redesign answered `complex` is unpinned, applies nothing, and leaves it
there. The owner's configured model is never reached again, and turn two's
own receipt names the cheap model as its "model without routing".

An unpinned tier now switches BACK to the model the session ran on before
routing first moved it, through the same seam and under the same two locks
a pin uses. The receipt still says the tier applied nothing, because it
did: `model_chosen` stays UNPINNED and `applied`/`model_used` are written
for a pin only. A restore that cannot be expressed attempts nothing and
keeps the model, which is what every refusal already does: no baseline
latched, a session already on it, a baseline the backend never named, or
no switch seam at all.

That pre-route model is also what `baseline_model` reports on every turn.
Read off the live session it is the PREVIOUS turn's tier from turn two on,
which is how the dearest turn of a conversation comes to claim the
cheapest model as its own default.

It is latched on the SESSION, not the slot: one attribute on the same host
the explicit-pick epoch lives on. Several slot aliases can drive one wire
session while each alias's `served_model` is only that alias's cache of
the session's answer, so a per-slot latch gives a second alias the first
one's routed model as its own baseline and leaves no alias able to put the
session back. For the same reason the alias's cache is re-read from the
live session on every routed turn -- a routed turn through a sibling alias
moves the session's model and bumps no counter to gate that read on.

The record carries the session id and the pick epoch it was taken under,
and one equality invalidates it on all three grounds: a moved epoch (an
explicit pick by hand, through this slot or any other alias, including the
session's first), a different session id (a pooled runtime claimed for a
new session), or no record at all. A model the owner just chose is a newer
instruction than anything latched before it, and a restore must never put
the session back on a model they have left. The in-lock guard re-reads
that epoch beside the live model, because a cross-alias pick landing
inside the `decide` round trip leaves this slot's own cache untouched.

Nothing is persisted, the same rule `jev_route` follows.
@iamwhatever
iamwhatever force-pushed the fix/jev-model-route-ratchet branch from ece5024 to 111ce37 Compare September 23, 2026 07:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 111ce3726307cdb1469b1af6940ee91b83f90d45; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 111ce3726307cdb1469b1af6940ee91b83f90d45: <one-sentence reason>

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 111ce3726307cdb1469b1af6940ee91b83f90d45; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 111ce3726307cdb1469b1af6940ee91b83f90d45: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@chenmingwei23
chenmingwei23 merged commit dc1f41b into main Sep 23, 2026
97 of 108 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/jev-model-route-ratchet branch September 23, 2026 16:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 23, 2026
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…tdev#12872)

A routed turn switches the live session onto the answered tier's model and
nothing puts it back, so on a PARTIALLY pinned tier map -- which is what
every install is on the way to, since all three tiers ship empty -- the
first answered pinned tier captures the session for the rest of its life.
A one-line rename answered `simple` moves the chat to the cheap pin; the
redesign answered `complex` is unpinned, applies nothing, and leaves it
there. The owner's configured model is never reached again, and turn two's
own receipt names the cheap model as its "model without routing".

An unpinned tier now switches BACK to the model the session ran on before
routing first moved it, through the same seam and under the same two locks
a pin uses. The receipt still says the tier applied nothing, because it
did: `model_chosen` stays UNPINNED and `applied`/`model_used` are written
for a pin only. A restore that cannot be expressed attempts nothing and
keeps the model, which is what every refusal already does: no baseline
latched, a session already on it, a baseline the backend never named, or
no switch seam at all.

That pre-route model is also what `baseline_model` reports on every turn.
Read off the live session it is the PREVIOUS turn's tier from turn two on,
which is how the dearest turn of a conversation comes to claim the
cheapest model as its own default.

It is latched on the SESSION, not the slot: one attribute on the same host
the explicit-pick epoch lives on. Several slot aliases can drive one wire
session while each alias's `served_model` is only that alias's cache of
the session's answer, so a per-slot latch gives a second alias the first
one's routed model as its own baseline and leaves no alias able to put the
session back. For the same reason the alias's cache is re-read from the
live session on every routed turn -- a routed turn through a sibling alias
moves the session's model and bumps no counter to gate that read on.

The record carries the session id and the pick epoch it was taken under,
and one equality invalidates it on all three grounds: a moved epoch (an
explicit pick by hand, through this slot or any other alias, including the
session's first), a different session id (a pooled runtime claimed for a
new session), or no record at all. A model the owner just chose is a newer
instruction than anything latched before it, and a restore must never put
the session back on a model they have left. The in-lock guard re-reads
that epoch beside the live model, because a cross-alias pick landing
inside the `decide` round trip leaves this slot's own cache untouched.

Nothing is persisted, the same rule `jev_route` follows.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants