fix(mailbox): serialize completion registration writers - #264
Draft
nestharus wants to merge 3 commits into
Draft
Conversation
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 means
Completion registrations that share one
pid-identity.dbnow serialize before writable sidecar open. If registration-lock polling or SQLite busy waiting exhausts the shared contention-wait budget, the requested command still does not launch.This does not promise that the complete registration operation finishes within five seconds. Synchronous setup, SQLite execution, filesystem I/O, and commit durability are not deadline-interruptible.
What's broken
Seven preserved production completion registrations across three provider sessions exited 74 before workload launch under concurrent activity; reduced-concurrency or isolated retries succeeded.
The retained failures do not identify the exact SQLite statement, extended error code, lock holder, admission order, or installed source identity. Shared
pid-identity.dbcontention in the mutable registration path is the strongest supported failure class, but exact historical causation remains unknown.What this PR does
crates/oulipoly-state/src/mailbox.rsso completion registrations for onepid-identity.dbenter the complete mutable registration path one at a time.src-tauri/build.rsto watch the actual Git worktree metadata paths, ensuring the embedded commit is rebuilt when the checked-out ref changes.How it works at runtime
pid-identity.registration.lockbesidepid-identity.dband repeatedly attempts a nonblocking exclusive lock while registration's contention-wait budget remains.Guarantee and limits
pid-identity.dbwriters do not acquire the registration lock; they remain SQLite-coordinated and can consume the remaining SQLite busy-wait budget.Existing exact-head verification
These commands were already executed against head
8dff7f496ab0bde5d9ffd85cf05d6ca064e68dc5; this claim-only correction did not rerun tests or change source bytes.cargo test -p oulipoly-state --test age300_registration_contention -- --nocapture: 4 passed, covering a six-registration burst, the remaining shared SQLite busy-wait budget, independent sustained-arrival disposition, and idempotent replay after admission timeout.cargo test -p oulipoly-state --lib completion_registration_ -- --nocapture: 3 passed, covering lock-open error context, admission before writable open, and admission through atomic commit.cargo test -p oulipoly-agent-runner --test wu_b_mailbox_integration command_registration_over_bound_fails_closed_and_replay_is_idempotent -- --exact --nocapture: 1 passed.cargo test -p oulipoly-state: passed.cargo test -p oulipoly-agent-runner --test wu_b_mailbox_integration: 35 passed.cargo test -p oulipoly-agent-runner --test initiative_06_schema_probe: 15 passed; the rebuilt binary reported the exact source commit.cargo fmt --all -- --check: passed.cargo clippy -p oulipoly-state --all-targets -- -D warnings: passed.cargo clippy -p oulipoly-agent-runner --test wu_b_mailbox_integration --test initiative_06_schema_probe --test wu_d_proactive_wake_integration -- -D warnings: passed.Pending AGE-300 proof