Repository navigation
lanes: rest the provider refresh while nothing routes - #2010
Merged
Merged
Conversation
AbirAbbas
added a commit
that referenced
this pull request
Oct 28, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
AbirAbbas
added a commit
that referenced
this pull request
Oct 28, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
AbirAbbas
force-pushed
the
perf/app-lane-refresh-idle
branch
from
October 28, 2026 03:54
937db19 to
9e72a20
Compare
Every open engine (terminal or desktop) refreshed every remembered model's provider lanes every five minutes for as long as it ran, reloading the ledger and reaching providers for models nobody was using. Demand is now measured where routing happens: every lane selection for a send or a probe stamps the registry's last-routed time (lock-free, no wait on a refresh). The beat refreshes at startup as before and keeps its cadence while something has routed within the last interval; after a full idle interval it stops its timer. The first selection after that wakes it through a retained catch-up request (never lost, even if the routing ends at once), and if the sheet is stale one refresh runs in the background while the call routes on the existing beliefs. Every caller is covered without declaring demand, including pool judging, factory triage and typing probes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
AbirAbbas
force-pushed
the
perf/app-lane-refresh-idle
branch
from
October 28, 2026 04:02
9e72a20 to
e7d895f
Compare
AbirAbbas
marked this pull request as ready for review
October 28, 2026 04:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An open engine (terminal or desktop) refreshed every remembered model's provider lanes every five minutes for as long as it ran: a ledger reload and provider requests for models nobody was using, all day on an idle machine. Now the refresh rests when nothing routes.
Registry.RecordRouting(internal/lane/routing.go): one atomic load and a compare-and-swap, no lock, no wait on a refresh. Callers do not declare anything, so every route is covered: agent turns, tasks, automations, side errands, pool judging, factory triage, typing probes,run/do.internal/lane/sheet.go) warms the sheet at startup exactly as before. It keeps its five-minute cadence while something has routed within the last interval, and stops its timer after a full interval with no routing.execandplan revisedoors never had a beat and are left out.How it got here (three adversarial review passes, read-only)
lanes.PrefsRefused, read-only, now gates the record). Regression testTestATerminalPreferenceRefusalLeavesTheBeatIdle: 2 fetches without the fix, 1 with it.Validation contract → tests
TestTheIdleBeatDoesNoWorkForAnHourTestRoutingKeepsTheBeatUntilOneIdleInterval,TestRoutingStopsUnreadModelsAfterTheIdleThresholdTestStaleRoutingStartsOneRefreshWithoutWaiting,TestProbeRoutingDoesNotWaitForRefreshOrSendTestRoutingBeforeBeatDispatchKeepsItsCatchupTestBareProviderRoutingWakesTheBeat,TestColdProbeSelectionAloneWakesTheBeat,TestInstalledProbeChooserStillCountsRoutingTestProviderRoutingGatesLeaveTheBeatIdle,TestRoutingPredictionsLeaveTheBeatIdle,TestRoutingWakesEveryIndependentSheet,TestRoutingDuringBeatRegistrationReachesEverySheetChecks
gofmt -lclean;go vetoninternal/lane,internal/provider,internal/session,cmd/codeaf.go vetoninternal/laneandinternal/provider, and the named lane/provider tests pass.1e4a7e1c3) baseline runs 40627876452 (gate) and 40627880992 (full).TestTheSameSentenceIsInTheJSONAnsweris aTempDir RemoveAllteardown race.TestAStoppedTaskResultCannotAutoStartItsRequestAgainalready failed on app: bound the idle scan over closed chats (desktop idle CPU) #2007's run, which touched neither lanes nor sessions.TestAStopDuringProofKeepsTheControlledFailureEnding(internal/secaf) passes 10/10 locally on this head, as does the session test.TestTheNodeDoorCommitsARunRowNotesKeyInTheStore, the same teardown race, 6/6 locally). Flakes.Re-verified before merge (2026-10-28)
On today's
app/v3(2e649b4, after #2008) merged with this branch; noapp/v3change since the merge-base touchesinternal/lane,internal/provideror the session lane setup.gofmtclean on the 9 changed Go files;go vet ./internal/lane/ ./internal/provider/clean; whole packagesgo test ./internal/lane/ ./internal/provider/: 1,048 top-level tests (1,391 with subtests), 0 failures.codeaf appon fresh homes in a loopback-only network namespace, a local stub provider with a dummy key; one chat open, idle, one turn at 16 min, shutdown at 28 min):After the turn the new engine rested again for the rest of the run. Both engines exited 0.
codeaf plan runon the new binary with the same stub routed its one request and exited 0.🤖 Generated with Claude Code