Repository navigation
Keep Inbox GitHub lock file owner-only - #2256
Merged
Merged
Conversation
This was referenced Nov 17, 2026
Merged
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
Open
.github-inbox-lockowner-only (0o600) insrc/logs/github.rs::refresh, matching the owner-only exclusive lock setup already used by GitHub quota and plan-usage records so another local user cannot open the lock file read-only, take anflock, and stall Inbox refreshes:src/github/quota/store.rs(open_owner_only_lock,try_lock_exclusive) +src/github/quota.rs: extract shared owner-only lock opening (OpenOptionswithcreate(true).truncate(false).write(true).mode(0o600)followed byset_permissions(0o600)) alongsidelock_exclusive, and add non-blockingtry_lock_exclusivereturningOk(None)onTryLockError::WouldBlock.src/logs/github.rs(refresh): replaceFile::createwithcrate::github::quota::try_lock_exclusive(&config.logs_dir.join(".github-inbox-lock"))?, keeping_lockheld for the scope ofrefreshand returningOk(kept)onWouldBlock.src/logs/github.rs(tests): add unit tests verifying new lock creation at0o600, tightening a pre-existing0o644lock to0o600, and returningkeptwhile still tightening a0o644lock held by another descriptor.Evidence
Execution evidence
Seams under test:
src/logs/github.rs::refreshBefore (Red)
refresh_creates_inbox_lock_with_owner_only_permissionsagainstFile::createunder umask0002):refresh_tightens_existing_inbox_lock_to_owner_only_permissionsagainstOpenOptionswithoutset_permissions, pre-existing0o644lock):After (Green on
e26e9f68)cargo fmt --check: exited 0cargo clippy --all-targets -- -D warnings: exited 0 (0.87s)cargo test --bin thirdshift logs::github::tests:3 passed; 0 failed; 0 ignored; 1967 filtered out; finished in 0.21scargo test --bin thirdshift github::quota:6 passed; 0 failed; 0 ignored; 1964 filtered out; finished in 0.09scargo test --test console github:19 passed; 0 failed; 0 ignored; 335 filtered out; finished in 17.68scargo nextest run --test console: exited 0 (3m10s)cargo test --test dismiss:25 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 11.86sPATH="/home/jacob/.cargo/bin:/usr/local/bin:/usr/bin:/bin" cargo test --test plan_usage:7 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 13.33spython3 -m unittest discover -s scripts -p 'test_*.py':Ran 72 tests in 44.394s(OK)PATH="/home/jacob/.cargo/bin:/usr/local/bin:/usr/bin:/bin" NEXTEST_TEST_THREADS=3 python3 scripts/affected-tests main: exited 0 (Summary [4937.741s] 4771 tests run: 4771 passed (32 slow), 209 skipped; wrapperPASS cargo nextest run (4939.83s)). Note on environment overrides: earlier default-env runs ofscripts/affected-tests mainfailed on three host-environment issues outside this change — 4-core CPU saturation flakes intests/dismiss.rs(dismiss_live_silent_row_moves_it_to_working_and_keeps_it_running) andtests/console/api.rs(api::release_url_keeps_api_openapi_and_cli_parity), and host/home/jacob/.local/bin/agyremaining onPATHduringtests/plan_usage.rs(plan_usage_shows_configured_routes_in_order_and_omits_api_key_and_unused_harnesses) — so~/.local/binwas omitted fromPATHand concurrency was capped withNEXTEST_TEST_THREADS=3; all three suites also passed standalone as recorded above.Merge Danger
src/logs/github.rs::refresh) and shared local lock helper (src/github/quota/store.rs::open_owner_only_lock,try_lock_exclusive; existinglock_exclusivecallersgithub::quotaandplan_usage::storepreserve identical owner-only0o600creation and permission tightening).Unaddressed findings
src/logs/github.rsandsrc/github/quota/store.rs), which was addressed ine26e9f68and confirmed resolved on follow-up review. Spec review raised 0 findings.src/github/quota.rs,src/github/quota/store.rs,src/logs/github.rs).CI notes
The failure in run 44082567872 comes from an unrelated test this branch does not touch:
thirdshift::show_logs a_tickets_issue_names_its_run_inside_the_spec_command(tests/show_logs.rs:396,assertion failed: logs.stdout.contains("session_id")): intermittent async pipe-flush race. Fakeclaudeprintsinit(session_id) to stdout just before launching the ticket script (touch startedintests/fakes/claude.rs), and the test polls only forstartedbefore running a one-shotthirdshift logs widgets#21 --session implement(stream_log(..., false)insrc/logs/status/inspect.rs), which exits0with empty stdout if the child Ticket run's stream reader (followinsrc/session/recording.rs) has not yet written the first OTLP line to the pre-created.logs.jsonlfile under concurrent CI load. This branch (4fb1bdb1, merging7373a1f4Release 0.35.1 intoe26e9f68) modifies onlysrc/github/quota.rs,src/github/quota/store.rs,src/logs/github.rs,Cargo.toml, andCargo.lock, andlogs/show/Spec runs never invokesrc/logs/github.rs::refreshortry_lock_exclusive; locally on4fb1bdb1,a_tickets_issue_names_its_run_inside_the_spec_commandpassed 49 of 49 standalone/parallel runs andcargo test --test show_logspassed (17 passed; 0 failed; 2 ignored), alongsidecargo fmt --check,cargo clippy --all-targets -- -D warnings,python3 -m unittest discover -s scripts -p 'test_*.py'(72tests),python3 scripts/generate-release.py --check,cargo test --bin thirdshift logs::github::tests(3 passed),github::quota(6 passed),plan_usage(37 passed),logs::reading::tests(51 passed),cargo test --test console github(19 passed),cargo test --test dismiss(25 passed; 2 ignored),PATH="/home/jacob/.cargo/bin:/usr/local/bin:/usr/bin:/bin" cargo test --test plan_usage(7 passed; 2 ignored), andcargo test --test status(80 passed; 2 ignored).rust-x86 / complete(job 134041756329) andtest(job 134041858511) failed only as aggregates ofrust-x86 / run (3).Closes #2254
Built with agy 1.5.9 · gemini-4-hydrogen-xhigh · default effort
Security review outcome
No unaddressed introduced findings.