Skip to content

Stop pinning HMM route decisions#677

Merged
Symbiomancer merged 10 commits into
mainfrom
evanusa/remove-hmm-session-pinning
Jul 9, 2026
Merged

Stop pinning HMM route decisions#677
Symbiomancer merged 10 commits into
mainfrom
evanusa/remove-hmm-session-pinning

Conversation

@Symbiomancer

Copy link
Copy Markdown
Contributor

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

Symbiomancer and others added 9 commits July 8, 2026 13:31
…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

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown

Claude finished @Symbiomancer's task —— View job


Posted one comment-length advisory review on internal/proxy/service.go (lines 953–955).

@workweave-bot workweave-bot 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.

Advisory only — comment-length nits. Won't block merge.

@workweave-bot workweave-bot 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.

Advisory only — comment-length nits. Won't block merge.

Comment thread internal/proxy/service.go

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread internal/proxy/service.go
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex completed the requested verification but local artifact references were not uploaded.
  • The primary proof was the focused HMM pin-switch after run, which showed tests passing and runtime logs for fresh HMM decisions, non-sticky switches, HMM EV stay, HMM history exclusion, and upgrade-confidence switch behavior; two broader suggested commands were attempted but the MCP call timed out before producing Go output beyond command headers, so the focused run was used as the executed proof.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment thread internal/proxy/service.go
@claude

claude Bot commented Jul 9, 2026

Copy link
Copy Markdown

Claude finished @Symbiomancer's task —— View job


  • Run git diff to find added comment blocks
  • Analyze comment blocks for verbosity (3+ lines)
  • Post advisory review

Posted one review with two comment-length nits on:

  • internal/proxy/service.go:953–955 — godoc lines 1–2 split one sentence
  • internal/router/sessionpin/store.go:78–80 — 3-line struct field comment merges into one

View job

@workweave-bot workweave-bot 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.

Advisory only — comment-length nits. Won't block merge.

Comment thread internal/proxy/service.go
Comment thread internal/router/sessionpin/store.go
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.

3 participants