Repository navigation
fix(app): eliminate recovery startup Config race and order worker lifecycle - #2310
Merged
Merged
Conversation
Resolve the reproduced startup Config race, defer durable recovery until composition succeeds, and join workers before backend teardown. Co-authored-by: Mecatl <[email protected]>
Use quiescence, cancellation acknowledgments, and service/backend witnesses; mutation-check early launch and missing joins. Co-authored-by: Mecatl <[email protected]>
JAORMX
marked this pull request as ready for review
October 14, 2026 13:29
10 of 14 tasks
Remove incidental composition detail from the memory architecture chapter and replace issue-specific test names with behavior-based names. Co-authored-by: Mecatl <[email protected]>
Merged
2 tasks
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
Fixes #2268.
Reproduction and cause
Reproduced on
ab30305e7with a test-only, channel-gated fixture using real Build composition, a persisted source session, queued durable work, and offline repositories/providers. The fixture gates recovery claim completion and late startup model discovery; it does not add production hooks or sleeps.The pre-fix diagnostic failed during 50 race-enabled repetitions in 1.785s with the exact issue stacks:
Recovery reaches the local provider callback while Build is still assigning
cfg.maintenanceMutationAvailable. Passing capturedcfgby value reads the whole struct, even when Shell is disabled. The original 200-repeat restart stress test passed during investigation, demonstrating why stress alone is insufficient.The committed regression fixture,
TestBuildAttemptRecoveryWaitsForCompositionininternal/app/attempt_recovery_startup_test.go, asserts the corrected lifecycle rather than requiring premature startup. Synctest with in-memory gRPC transport provides scheduling witnesses; held callbacks and cancellation acknowledgments expose teardown ordering. Temporary mutation checks (10 repetitions each) failed at the intended assertions for early recovery launch, service teardown before joins, either loop canceling without joining, and unavailable maintenance continuing into GC.Verification
task testtask lintGOFLAGS=-p=4 task --concurrency 2 test:race— complete suite passedtask docsgo run ./cmd/mecademo: tool call, permission ask/approval, resultLocal full gates use the short system temporary root: the first managed-temp run exceeded UNIX-domain socket path limits in existing embedded-client tests; the same complete offline suite passed with the short root. The unrestricted race run exhausted
/tmpduring concurrent linking; limiting Task/build concurrency allowed the complete gate to pass. No test was disabled.Earlier race attempts also exposed two unrelated failures, investigated rather than silently retried: the MCP login fixture sends its callback before installing the expected state (identical failures on baseline: 6/100; patch: 8/100), and an unchanged standalone microVM helper exceeded its two-second receipt deadline under load (focused race run passed; its dependency closure contains no app code). A diagnostic attempt using global
GOFLAGS=-jsonconflicted with architecture tests' nestedgo list -f; that invocation error was removed. These findings did not lead to changes outside this PR's scope.CI status
All checks on
199d51c3cpassed or were intentionally skipped, including the full race job. The unrelated OAuth fixture failure seen on the prior revision remains documented above.API compatibility
Compatible lifecycle/ownership correction. No wire fields, public Go APIs, stored-data formats, placement identities, provisioner contracts, or feature identifiers change. No API major bump, approval for a breaking change, or client upgrade is required.
Deliberate scope boundary
The issue comments also identify context-only environment inspection and recovery's missing Kubernetes
BindingID. Those are separate concerns: this PR does not redesign provisioner APIs, change exact reattachment, or claim that learning recovery avoids cold microVM acquisition.