Stop pinning HMM route decisions#677
Conversation
…view)
The cost-gate's 'upgrade to a pricier model' gate was hardcoded as
internal/proxy/turnloop.go: const 0.85. Pulled it out as a Service field
with default 0.85 and added WithHMMUpgradeConfidenceThreshold setter;
main.go wires ROUTER_HMM_UPGRADE_CONFIDENCE_THRESHOLD. Out-of-range values
(< 0 or > 1) are rejected and the existing threshold stays.
Three tests in turnloop_internal_test.go:
- TestService_NewService_HMMUpgradeConfidenceDefaults locks the default
- TestService_WithHMMUpgradeConfidenceThreshold covers in-range, double
out-of-range cases, and zero
- TestHMMCostGate_UpgradeThresholdConfigurable exercises a
lower-than-default threshold through the cost gate end-to-end
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cursor Bugbot findings: - hmmStayPin now ignores a non-HMM (cluster/planner) active pin so a stale pin from a prior strategy can't steer an HMM turn's EV stay; only hmm_history / hmm_policy* reasoned pins are stay candidates. - HMM history maxed-out exclusion no longer gated on PinnedUntil, matching the active-pin path — a saturated model stays excluded after the row's TTL lapses so the auto-continue loop can't re-select it. - recordHMMTurnHistory skips the UpdateUsage writebacks on all-zero usage (failed/empty turn) so a failure can't clobber prior token counts and last_turn_ended_at; the TTL-refreshing upsert still runs. workweave-bot comment-length nits: shortened field/godoc/inline/test comments. Tests: added coverage for the non-HMM-pin gate (ignore + honor), the zero-usage history guard, and the expired-maxed-history exclusion. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Trim the three comments added in the previous review-fix commit to 2 lines each (zero-usage guard, maxed-history no-expiry-gate, non-HMM-pin gate). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ssion-pinning # Conflicts: # internal/proxy/service.go # internal/proxy/service_session_pin_test.go # internal/proxy/turnloop.go # internal/proxy/turnloop_internal_test.go # internal/proxy/turnloop_test.go
|
Claude finished @Symbiomancer's task —— View job Posted one comment-length advisory review on |
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 55aa45b. Configure here.
What T-Rex did
Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
|
Claude finished @Symbiomancer's task —— View job
Posted one review with two comment-length nits on:
|
workweave-bot
left a comment
There was a problem hiding this comment.
Advisory only — comment-length nits. Won't block merge.

Stops HMM route decisions from writing active session pins while preserving HMM history, switch tracking, and configurable upgrade-confidence gating.