Repository navigation
factory: a runner notices a provider key that arrives after it started - #2596
Merged
Merged
Conversation
The worker attached with the word for what its machine lacks read once, so a runner started before any provider key existed kept saying needs_provider after keys.set, and queued work was never leased until the engine restarted. The worker now asks before each lease poll and re-attaches when the word changes, between jobs; a running lease is left alone. Removing the only key brings needs_provider back the same way. Fixes #2594 Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.
What this fixes
Fixes #2594. A desktop engine whose factory runner started before any provider key existed kept reporting
needs_providerafter a key was set, and queued work was never leased until the engine restarted. The worker read "what this machine lacks" once, when it attached.The worker now asks before each lease poll and re-attaches when the answer changes, between jobs. There is still one place that decides the word (
appFactoryHost.needs); no new lock, timer or goroutine.Validation contract
needs_providerstops within one lease poll of a key being set, with no restart, and work queued meanwhile is leased.needs_providerwithin one poll instead of leasing a step that would refuse.needs_provider.cmd/codeaf/app_factory_provider_test.gohas one test per B1–B4 through the real app wire, backend, local factory and worker, with an approval-only pipeline and a model endpoint that fails the test on any generation request. B1 fails on the unchanged code withrunner state="needs_provider" … job state="queued".What was driven by hand
The issue's replication on the built binary, over the app wire with a fresh home: the runner went from
needs_providerto busy with the job leased 0.93 s afterkeys.set, in the same process. Found and reproduced three times in the live WorkAF loop before the fix.Locally
make test-lawsis red only oninternal/tui3TestEveryPlaceTakesExactlyTheWholeFrameAtEveryWidth/AI_teams, which fails the same way on unchangeddevon the development laptop; this change touches no TUI code.🤖 Generated with Claude Code