Home lock not released promptly at shutdown: storage_startup flake (restart risk?) #664
Closed
opened 2026-10-21 18:39:07 +00:00 by kayg
·
95 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
kayg/calternal#664
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
crates/calternal/tests/storage_startup.rs:300
single_root_upgrade_backup_split_cache_delete_and_rollbackfails intermittently (train AQ; folder-ids review 7) with WouldBlock: "another Calternal server is using …/home (lock …/home/.lock)". It passes 20/20 when run alone. The previous server instance's Home lock is apparently released asynchronously after shutdown. Product question: can a real restart (a deploy, or a systemd/podman restart) fail to start for the same reason?Starting work on
issue/home-lock-release, based on8b30062e1c14966e05e14ea67f8feb65e6e355c4(origin/dev). I will trace lock ownership, add the requested restart coverage, and run the quoted gates.Finding:
DataLock::acquire_existingholds the.lockfile inDataLock;storage::preparereturns the Home and state guards, andmainretains them across HTTP graceful shutdown andNotes::shutdown.Notes::shutdowncurrently flushes open rooms and checkpoints list stores, but Home startup launches detached scan, watcher, list-reconcile, trash, and job tasks. The watcher process can keep anArc<Home>while the Home owns the watcher callback sender, and history/index writers are detached threads that exit only when their senders drop. I am making the in-process shutdown path explicitly quiesce and join these holders before releasing both locks; the external binary is killed and reaped by the existingstartshelper, so the current test does not cover that in-process lifecycle.Restart finding: both Quadlet units set
TimeoutStopSec=30, anddeploy/next/remote.shstops the old service then checks for the old container for up to 20 seconds before starting the replacement. The normal deploy path therefore waits for container exit, but any overlap or systemd restart race currently fails immediately becausemaincalls the non-waitingstorage::prepare. Server startup now has a 10 second bounded retry for either root lock; it still starts only afterprepareowns both locks.Another holder identified:
Home::index()starts a detachednotes-unloadOS thread. It can wake later and unload the index after shutdown. I am making the idle timer interruptible and joining it duringHome::shutdown, alongside the Home background tasks and database writers.The focused shutdown test and full release gates are queued through the build slot. The shared test train is still active, so no local compile has started yet. I am waiting for the reserved slot to clear.
The first focused compile found a stable-Rust error in the test-only unload timer name assignment. Evidence: rustc reported E0658 at crates/notes/src/unload.rs:93, ‘attributes on expressions are experimental’. I changed both cfg(test) statement attributes to cfg(test) blocks. The release gate batch is rerunning against that fix.
The first clippy run found eight
clippy::let_underscore_futureerrors at the sites that intentionally discard background-task receivers;-D warningsmade the gate fail. I changed those call sites to explicitly drop the receivers. The full gate batch is rerunning through the build-slot wrapper.The full clippy build reached the new server stress test and found a compile error: Axum’s
WithGracefulShutdownvalue is not aFuturefortokio::spawn(E0277 at crates/calternal/src/isolation.rs:957). I wrapped its.awaitin an async task. The gate batch is being rerun.Finished the Home lock shutdown work on branch issue/home-lock-release.
Head SHA:
e76ec623a6Gate output (verbatim pass lines):
== fmt ==
== diff-check ==
== clippy ==
Finished
devprofile [unoptimized + debuginfo] target(s) in 4.14s== workspace test 1/3 ==
Finished
testprofile [unoptimized + debuginfo] target(s) in 2m 53stest result: ok. 21 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.31s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.25s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.37s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.69s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.04s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.90s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 9 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 10.03s
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.32s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.31s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.56s
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s
test result: ok. 19 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.52s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 27 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.64s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.58s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.51s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.19s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 37 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 316 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 25.12s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.19s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.45s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
== workspace test 2/3 ==
Finished
testprofile [unoptimized + debuginfo] target(s) in 0.27stest result: ok. 21 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.90s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.39s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.40s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.73s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.61s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.92s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
test result: ok. 9 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 10.05s
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.38s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.23s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.14s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.47s
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.15s
test result: ok. 19 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.96s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 27 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.47s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.60s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.51s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.12s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 37 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
test result: ok. 316 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 26.08s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.35s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.12s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.31s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
== workspace test 3/3 ==
Finished
testprofile [unoptimized + debuginfo] target(s) in 0.24stest result: ok. 21 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.16s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.31s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.47s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.22s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.64s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.90s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
test result: ok. 9 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 10.05s
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.40s
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s
test result: ok. 19 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.05s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.12s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 27 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.98s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.55s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.53s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.46s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 37 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 316 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 22.74s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.16s
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.31s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
== 200x in-process server shutdown stress ==
test isolation::in_process_server_shutdown_releases_both_roots_200x_under_load ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 21 filtered out; finished in 1.19s
== 100x original storage startup stress ==
test original_storage_startup_scenario_repeats_100x_under_load ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 9 filtered out; finished in 6.66s
Independent review started. Branch: detached HEAD (no branch created; review only). Head
e76ec623a6; base8b30062. CLAUDE.md is absent in this worktree and its ancestor directories; checking the primary checkout for applicable guidance. No commits, pushes, merges or deployments will be made.P1: An idle admin connection can hold both storage locks forever during shutdown.
At crates/calternal/src/admin.rs:125, the new shutdown path joins every accepted request without a deadline. serve() at lines 144-147 waits for a newline or EOF using read_line(), also without a deadline. A same-user client can connect and leave the stream open without sending a complete request. SIGTERM then reaches main.rs:174 and waits forever in admin.shutdown(), before Notes is flushed or either storage lock is released. A replacement instance gives up after ten seconds. This also happens with a stalled client that has no malicious intent.
Please bound reading an incomplete request, and make shutdown stop idle readers while still allowing a mutation already executing to finish durably. I have prepared a synchronized probe outside the repository that waits until the accepted request enters serve(), then checks shutdown remains pending until that exact client closes. Runtime results will follow after the build gate.
P2: Completed background tasks accumulate for the lifetime of every Home.
Home::spawn_background (crates/notes/src/home.rs:332-349) appends every JoinHandle to background. Nothing removes a completed handle until Home::shutdown (lines 722-735). rename::after_save now uses this tracker for every title-based rename timer; bulk jobs, their final progress tasks, and missing-target refreshes do too. Completed Tokio tasks retain their task allocation while a JoinHandle is held. A long-running server therefore retains memory and adds shutdown join work proportional to all past operations, even when the Home is idle. The vector itself also grows without bound. The normal save path now takes this growing tracker lock.
Please reap finished tasks during normal operation or use a tracker that releases completed tasks while preserving shutdown joins. A probe outside the repository completes 10,000 tracked tasks and inspects the remaining handles; runtime results will follow after the build gate.
Required gates on
e76ec623a6all passed. Review probes and baseline checks are waiting for a build slot. All heavy commands used the required wrapper and CARGO_TARGET_DIR.Verbatim wrapper output:
cargo fmt --check
cargo clippy --workspace --all-targets -j4 -- -D warnings
cargo test --workspace -j4
cargo test -p calternal --test storage_startup -j4 original_storage_startup_scenario_repeats_100x_under_load -- --ignored --exact --nocapture
Additional review validation is temporarily blocked on shared build capacity. The required fmt, Clippy, workspace tests, and 100-cycle restart gates all passed; their complete output is in the preceding comment. The synchronized runtime probes, baseline oracle, and many-note timings are queued through the mandatory build-slot wrapper. At this check, slots 1, 2, and 3 are held by other jobs; no processes were interrupted. I will continue waiting and complete the queued checks.
P1: Cancelling a pending startup scan can leave shutdown waiting forever for reconciliation.
Home::start marks the scan running before watcher setup sends the first Rescan. If a metadata or journal publication failure wakes list reconciliation in that window, reconcile_list waits in scan.wait_until_done() (home.rs:532-533). Shutdown sets its signal, and the watcher process returns immediately without settling scan state (watch.rs:184-188). Pending watcher setup then skips sending Rescan because the Home is shutting down. The reconciliation worker is already inside reconcile_list(), so its outer shutdown select cannot run. Home::shutdown waits forever joining that worker at home.rs:730-731, before either root lock is released.
The synchronized probe pauses watcher setup before its initial scan request, queues reconciliation, observes that reconciliation entered its scan wait, starts shutdown, and releases setup. Shutdown remains pending with scan.is_scanning() still true; signalling scan completion immediately unblocks it. No fixed sleeps are used. The pause only selects a schedule allowed by normal slow watcher setup.
Verbatim probe output:
Please make the wait inside reconciliation observe shutdown, or explicitly settle cancelled scan state before joining its waiters. Preserve incomplete discovery semantics; do not mark a cancelled scan successful for serving clients.
Runtime evidence for the review findings on
e76ec623a6. These probes ran from an external source copy; only synchronization hooks and review tests were added. The original worktree is unchanged.The admin and scan probes assert the hang remains pending, then release the exact blocking condition and join shutdown. The queued-typing probe verifies shutdown waits for stalled history and the edit survives reopening. The task-retention probe completes 10,000 tracked tasks and inspects the retained handles. The 200-cycle in-process shutdown stress test also passed.
head-notes-probes — verbatim output:
head-admin-probe — verbatim output:
head-inprocess200 — verbatim output:
Independent review finished at head
e76ec623a6, base8b30062e1c. Verdict: do not merge.Final verdict: do not merge
All requested gates passed, but they do not cover the reproduced shutdown hangs or unbounded task retention. The review remains open; issue 664 was not closed.
Completed validation
Reviewed base
8b30062e1cto heade76ec623a6. The original detached worktree remains clean. No commits, pushes, merges or deployments were made. All local heavy commands used the mandated build-slot wrapper; cargo used -j4 and CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-homelockrev. No staging, perf VM, or production VM was touched.The original-worktree gates passed: formatting, Clippy with warnings denied across all workspace targets, cargo test --workspace (780 passed, zero failed, four ignored), and the explicit 100-cycle storage_startup stress test. The new 200-cycle in-process shutdown stress test also passed.
The history-FD regression assertion was transplanted to base without changing its history oracle. Only setup/assertions involving the new idle-thread test accessor were removed because that accessor does not exist on base. It fails on base because shutdown returns with history.db open; the original test passes on head. The baseline 100-cycle storage scenario aborted with SIGBUS. That output alone does not identify its cause; it is not being presented as a reproduced WouldBlock error. The new startup-wait helper cannot be transplanted unchanged to base because its API is introduced by this diff.
The live-owner probe returned WouldBlock after 10.001422385 seconds, with both roots still exclusive. The queued-typing probe stalled history after fan-out, checked shutdown waited, released history, and verified the reopened Home contained the edit. No post-release write was reproduced on the exercised orderly paths. The two P1 hangs prevent release altogether. ADR 0020's history-before-saved and client replay rules remain important for unacknowledged client changes; this review did not find a demonstrated new loss of acknowledged text.
The first timing probe used a private scan field from an integration test and failed to compile. It was corrected to wait through the public paged-list incomplete flag. The corrected run visibly executed both storage probes. Earlier stale-cache and compile-failed probe runs are excluded from the conclusions.
Five alternating base/head pairs, 100 durable API append operations per fixture/pass. Times below are medians across five runs. Debug builds, shared loaded host, watching and automatic rename disabled; default idle index timer enabled. This is a local comparison, not a production latency budget.
The paired sample shows no consistent added API edit latency. Shutdown adds roughly 1–2 ms in these fixtures while joining workers. Cold discovery timing varied; the shared host, debug builds, 10,000-note size, disabled watching and automatic rename limit extrapolation to production. The unbounded retained-task finding is a separate long-lived memory and shutdown-work regression, directly confirmed by counting handles.
verified-base-history — verbatim output
verified-base-restart100 — verbatim output
verified-base-perf — verbatim output
verified-head-storage-final — verbatim output
perf-1-base — verbatim output
perf-1-head — verbatim output
perf-2-base — verbatim output
perf-2-head — verbatim output
perf-3-base — verbatim output
perf-3-head — verbatim output
perf-4-base — verbatim output
perf-4-head — verbatim output
perf-5-base — verbatim output
perf-5-head — verbatim output
Required gate output, verbatim
Required gates on
e76ec623a6all passed. All heavy commands used the required wrapper and CARGO_TARGET_DIR.Verbatim wrapper output:
cargo fmt --check
cargo clippy --workspace --all-targets -j4 -- -D warnings
cargo test --workspace -j4
cargo test -p calternal --test storage_startup -j4 original_storage_startup_scenario_repeats_100x_under_load -- --ignored --exact --nocapture
Starting round 1 fix for issue #664. Branch: issue/home-lock-release. Base origin/dev SHA:
9ed9b9a5e8. Starting branch head:e76ec623a6. I am merging origin/dev before changes.Findings with code evidence:
Admin shutdown can wait forever on a connected client. In crates/calternal/src/admin.rs, each accepted request calls serve, whose read_line has no timeout or shutdown signal; AdminHandle::shutdown joins the listener task, and that task drains every request JoinSet entry.
A list reconciler can wait forever for startup discovery. Home::start marks Scan as scanning before watcher setup schedules Rescan; shutdown can make watcher setup return without scheduling it. Home::reconcile_list then awaits Scan::wait_until_done without observing shutdown, and Home::shutdown joins that background task.
Completed Home background handles accumulate. Home::spawn_background pushes every JoinHandle into a Vec and only takes the vector during shutdown; no normal-operation path reaps finished handles.
Reproduced all three findings on
e76ec623a6with the new regression tests.{.10,000 completed tasks left 10004 Home task handles.Each failure is the intended baseline failure; all test commands compiled and ran against
e76ec62.Implementation commit
0896c25has been pushed to issue/home-lock-release. The final local gates are green, including the workspace tests, the 100x storage startup loop and the 200x in-process restart stress.The 10,000-note comparison is queued on the Perf VM behind five older flock processes; the oldest has been active for 2h42m. The run has not started yet. I am keeping the required lock in place and will report the paired measurements when it runs.
Blocked update: the final transport test and required local cargo gates are still queued because the shared build-slot wrapper is honoring an active test-train reservation. The 10,000-note comparison is also queued behind the required Perf VM lock. I have not bypassed either queue. The three requested regressions were proven red on
e76ec62and passed on the first fix commit; formatting passes on the current tree, but the newest response-write bound and final gates are still unverified. I am continuing when the locks release.Shutdown audit found one additional peer-dependent wait: Axum graceful shutdown joins accepted connection tasks, and a TCP peer that stopped reading could leave a response write pending before Notes shutdown and root-lock release. ShutdownIo now wakes pending reads at shutdown and bounds response writes to a 30-second grace. Evidence:
shutdown_io::tests::shutdown_bounds_response_writes_to_a_peer_that_stops_readingpassed; both shutdown_io tests passed (2 passed, 0 failed, 0.03s).#664 round 1: shutdown waits are bounded as an invariant
Head:
d2c410610d07e3d9bd3d22adb0d380423569d5c7onissue/home-lock-release(on top of Codex's0896c25and27f0adc).Per finding
27f0adcalready bounded request reads (30 s idle, 120 s total), stopped reads on shutdown, gave a started mutation a 30 s grace and bounded the reply write. The HTTP listener got the same rule (shutdown_io.rs): pending reads end at shutdown and writes get a 30 s grace. What was still missing: the admin stop usedwatch::changed(), which misses a stop sent before the request's receiver exists. That is a race between accept and stop, and in that case the request waited out its 30 s or 120 s timer. It now useswait_for(true).ScanState::release(). That wakes every scan waiter for good, and a laterbegin()(a retry racing shutdown) can't reset it, because the check happens under the channel lock. This covers the reconciler and also the 60 sscan.waitcallers (rewrite,tags/job,ensure_known).0896c25).backgroundis aJoinSetand finished handles are reaped on every spawn. Retained handles go from 10,004 one76ec62to 32 or fewer.The class fix ("something shutdown waits on may never finish"): every shutdown-aware wait in a Home (watch process and poll, the list reconciler, the rename timer, the Trash sweep, the bulk job lock) now goes through one helper,
home::stopped(). It useswait_for, so it also sees a shutdown that began before the receiver was made. Before this, a poller set up while shutdown started, or a rename queued by the final flush, would wait out its own timer (poll_every,rename_after). Home shutdown also joins background work a second time, after rooms save and before the writers close, so work started by the final flush can't outlive the locks.Audit: every await on the shutdown path
main.rs, in order:axum::serve(..).with_graceful_shutdown: every connection is wrapped inShutdownIo. Pending and future reads return EOF at shutdown, which also ends upgraded websockets. Writes may run 30 s past shutdown and then fail. Handlers do finite work (no long-poll or SSE; file downloads are finite streams).admin.shutdown(): the accept loop breaks on stop (biased, race-free). Then each request task is joined:handle: 30 s grace after stop, then dropped (jobs are persisted and replay)attachment_sweep,rotational_check: finitespawn_blockingfile-system work.announce: one auth DB call.storage::shutdown_server→Notes::shutdown:shutdown_serial: held only by other shutdown calls.shutdown_gate.write(): read guards are held only while a Home opens, which is bounded.open_alljoin: eachhome()fails at once once the gate is closed, and the loop breaks.Home::shutdown, in this order:is_shutting_down.join_background: every task ends promptly:process:stoppedat each wait; a scan already running is finite local work.poll, list reconciler (scan wait released), rename timer, Trash sweep: all usestopped.drive:stoppedfor the job lock, then it breaks between finite batches.queue_final_progresswaits on the history writer, which is still alive.flush_all: one Flush command per room, answered by its own actor (disk plus history, both alive).room.shutdown(): a Shutdown command, then the actor is joined.join_backgroundagain.history.shutdown(): the writer thread is joined.spawn_blocking.Tests
Each finding has one test. All three fail on
e76ec62(ported into a temporary detached worktree, since removed) and pass on the head:The admin test no longer needs a test hook: an answer on a second connection proves the idle one was accepted, so it compiles on both trees.
Invariant tests:
a_shutdown_wait_made_after_shutdown_ends_at_oncescan_waiters_stay_released_once_shutdown_releases_thema_stop_sent_before_subscribing_is_still_seenProperty test
randomized_home_shutdown_releases_both_roots(now multi-thread, 24 seeded cases). Each case has:It asserts that shutdown finishes within 5 s, that every edit reached disk, and that both roots can be locked again at once, without the startup wait.
Gates (verbatim)
Still open
scan::runwould cut that down if it ever matters.#664 round 2: startup waits out the longest shutdown grace
Head:
ce1cf6c4f3cad4bff942c14ecd46c6e8889770de(on top ofd2c4106).What changed
Grace constants in one place,
crates/calternal/src/grace.rs:ADMIN_REQUEST= 30 sHTTP_WRITE= 30 sSETTLE= 5 sLONGEST= max(admin, http)STARTUP_LOCK_WAIT = LONGEST + SETTLE(35 s today). It is derived from the constants, not hard-coded, so they can't drift apart.storage.rsandshutdown_io.rsuse these constants, and so does the admin socket.The graces now really start together. The admin stop goes out with the HTTP stop when the shutdown signal fires. Before, it went out only after HTTP had drained, which could add another 30 s.
The admin reply shares its request's deadline. A reply written after shutdown began shares that request's deadline, so request plus reply never outlast
ADMIN_REQUEST. Before, the reply could add up to 30 s on top.The clear error is unchanged. If the lock is still held after
STARTUP_LOCK_WAIT, it belongs to a live server that isn't stopping, and startup fails with the same WouldBlock "another Calternal server is using …" error.Tests (paused tokio clock, no real sleeps)
admin::tests::a_restart_waits_out_an_admin_request_longer_than_ten_seconds:test-hold,#[cfg(test)]) signals that it started, then holds for 12 s of tokio time.prepare_for_server_withon the same Home.held_ms: 12000in the reply, not cut off).storage_startup::a_lock_held_past_the_longest_grace_still_fails_startup: a lock held by a live server still fails with WouldBlock, after at leastSTARTUP_LOCK_WAIT.STARTUP_LOCK_WAITtemporarily set back to a fixed 10 s (and the test's structural assert removed), the restart test fails as it should. The tree was restored afterwards:hold test 50x: 50 passed, 0 failed.Gates (verbatim)
Left as is, by decision
SETTLEand the startup wait in practice. If it ever doesn't, the fix is a per-batch shutdown check inscan::run.Independent review, round 2:
ce1cf6c(base9ed9b9a, previous rounde76ec62). Verdict: do not merge (one P1).Gates: all green. fmt ok · clippy -D warnings ok ·
cargo test --workspace853 passed, 0 failed · storage_startup restart tests 200×: 0 failures · the same 100× under two nice-19 burners: 0 failures · notes_crash 20×: 0 failures · the ignored stress gates (original 100× under load, in-process 200×) pass. All three findings from the earlier round stay fixed, and each has a regression test.P1: work already running when shutdown starts can still write to the Home after
Notes::shutdownreturns (contract 1). Theshutdown_gateblocks newhome()calls, but it does not wait for callers that already got past it. A Home has no write barrier after shutdown:Home::roomstill opens new room actors (spawned with plaintokio::spawn, so nothing tracks them),place_createwrites the note file first, andspawn_backgroundstill accepts tasks. In the server, websockets are not covered by axum's drain. In axum 0.8.9,on_upgradespawns the socket task withtokio::spawnand the connection future ends at the upgrade. So theClientMsg::Acttasks (live.rs:267,engine.execute→note.create→Notes::create) and the room-join tasks (rooms.rs:74) are still running whenstorage::shutdown_serverdrops the locks.Notes::createatcrash::Point::BeforeWrite, letnotes.shutdown()finish (it returns while the create is paused), then resume. Result:before=[] after=["Late.md"], meaning a note file lands after shutdown.Arc<Home>, runnotes.shutdown(), thenhome.ask(id, Flush). Result:flush=ok, open_rooms=1, meaning a new room opens on a Home that has shut down. Edits fail because history is closed, so nothing acknowledged is lost. But file and list-store writes are not blocked.is_shutting_down()refusals inroom(),spawn_backgroundand the create/trash/rename write entry points. Track websocket and Act tasks in main and join or cancel them beforenotes.shutdown.P3 notes
SETTLE(5 s) and make the next server's 35 s lock wait fail. Consider checkingis_shutting_down()between scan chunks.settle/saveon an untracked task. Home shutdown never sees it.Idle::touchnow takes a mutex and callstry_sendon the timer thread for every index lookup. That wakes the timer thread on every lookup only so it can go back to sleep. It did not show up in the numbers below, but storinglastwithout the wake would be enough.Perf (Notes-level bench in release, 10k-note Home, 300 appends, 5 runs alternating base and head; shared host, so these only show direction):
The edit path shows no slowdown. Shutdown costs a few ms more, which is expected because head joins the writers.
#664 round 3: nothing writes to a Home after Notes::shutdown returns
Head:
d4225a8a320451ee54d6a08afbef51326c07eda6(on top ofce1cf6c). This fixes the review's P1 and the cheap P3s.Correction to the review comment: the head steady-state shutdown median was 3.9 ms, not 4.9 ms.
The invariant, and where it is enforced
New type
calternal_core::Drain. Work enters through it and holds it while it runs.close(max)refuses new work from that moment and returns once the work already in has ended. Ifmaxruns out first, it logs an error and returns false. A Drain is used at every way into storage:Engine::executeruns inside the executor's drain, and the detached action task keeps it open. Inmainit is closed at the shutdown signal, together with the HTTP and admin graces, bounded bygrace::LONGEST. This covers websocket actions, which axum's graceful shutdown doesn't wait for (live.rs:267 → engine → Notes::create), and every other plugin's actions, not just notes.Notes::enter: create, edit, trash, rename, restore, peek, rewrite, the missing-link ops, and the RoomService join.Notes::shutdown:Home::begin_shutdown), so background loops end and scan waits are released;Arc<Home>can't get around the drain:rooms_closedset under the same lock. After that,room()hands out a handle that refuses every request, andaskreturns "Notes is shutting down".background_closedis set under the same lock andspawn_backgroundrefuses new work. The future is dropped unrun.retired, finished ones are pruned each time a room retires, and shutdown joins them before the final background join.Other P3s
Idle::touch: lock-free when the timer is already armed. It records the use withSeqCstand wakes nobody, because a use only pushes the deadline later and the timer re-readslastwhen its current wait ends.Tests
The review's two repros are now permanent tests (
crates/notes/src/tests/shutdown.rs), plus a third for background work. All three fail once1cf6c(run in a temporary detached worktree, since removed) and pass on the head:Unlike the review version, the create test also checks that shutdown is still waiting while the create is held at
BeforeWrite, and that it returns only after the create has finished.New tests for the mechanism:
engine::tests::shutdown_waits_for_running_actions_and_refuses_new_ones: a detached action whose caller was aborted keeps shutdown waiting, and a new action is refused.core::drain: close waits for work already in and refuses new work; close gives up after its bound.Gates (verbatim; clean rebuild of workspace crates)
Notes
grace::LONGEST(HTTP writes, admin requests and actions all start at the signal), plus the Notes drain (5 s at worst; in practice nothing is left in it once the executor has stopped), plus the closing work. That is theLONGEST + SETTLEbudget the startup wait uses. Only if an action overruns its grace (it is then logged) can the old server still hold the lock after the new one's wait, and the new one then fails with the clear error.Independent re-review:
d4225a8, compared withce1cf6cand base9ed9b9a. Verdict: merge. One P2 should be fixed before merge or as an immediate follow-up.Last round's P1 is fixed.
Engine::executenow holds aDrainslot for the whole action, including the detached task that keeps running after a websocket caller goes away. The public notes operations that change a Home, and room joins, now go throughNotes::enter.Home::roomrefuses requests once the rooms are taken, andspawn_backgroundno longer starts anything after the last join. Both of my earlier repros are now permanent tests (I read them).Drain::enternever waits (try_read), so a nestedenterwhile shutdown is closing just fails instead of blocking.begin_shutdownreleases scan waiters before the drain waits. Actions that arrive in a flood after the drain closes are refused. Ones admitted just before are waited for, up to 30 s.Idle::touchtakes no lock on the common path; I checked the armed/revision ordering and found no lost timer. The startup error now says another server is running.P2: work that outlives the grace can still write after the locks are released (contract 1). The author listed this as a known leftover; I confirmed it.
Notes::createatBeforeWritepast the 5 s drain. Result:shutdown_took=5.003s before=[] after=["Late.md"], so the note file lands afterNotes::shutdownreturned.t.holduntilengine.shutdown(200ms)returns false, then release it. Result:journal before=0 after=1, so the abandoned action records into the store after shutdown gave up on it.storage::shutdown_serverdrops the locks.P3:
RUNNING_DRAIN(5 s) runs after the 30 s action grace, butSTARTUP_LOCK_WAITis onlyLONGEST + SETTLE. A worst-case stop (an action that uses its whole grace, then the 5 s drain, then closing work) can therefore outlast the next server's lock wait. AddRUNNING_DRAINto the derivation.Gates (binaries checked: built at
d4225a8, contain the new code): fmt ok · clippy -D warnings ok ·cargo test --workspace859 passed, 0 failed · storage_startup restart tests 200×: 0 failures · the same 100× under two nice-19 burners: 0 failures · notes_crash 20×: 0 failures · the ignored stress tests (original 100×, in-process 200×) pass.Perf (release bench, 10k-note Home, 300 appends, 5 alternating pairs; shared host, so these only show direction; base bench md5 69968abb, head md5 eb8d6c38 and it contains
drain.rs). Medians, base → head:#664 round 4: late work can't write after the locks go; startup waits for every stop phase
Head:
690f394a5fe7ccd5f7fdc7cee30377a4c7aff3b8(on top ofd4225a8). This fixes the re-review's P2 and P3.P2: work that outlives the grace
1. The locks are released by process exit, not by the server.
storage::shutdown_servershuts Notes down and then keeps both root locks (mem::forget).#[tokio::main]drops the runtime whenmain's body returns, and dropping it waits for the blocking pool. The process then exits, and the kernel releases the flocks only after every thread has stopped. So a blocking file write still running can no longer finish after another server holds the roots. In-process tests, which start the next server in the same process, use the newshutdown_server_and_release.2. Write points refuse late work (belt and braces).
Drainnow records whenclosegave up (gave_up()). After that the executor refuses to commit, both an action's final commit andJournalSinkprogress batches, with "the server stopped before this action finished".writes_closedonce shutdown has joined everything (rooms, retired rooms, background work).Home::writable()is then checked before every file write:place_createblockinghelper now takes the Home)PRAGMA query_only=1), so a late list write fails.Notes::shutdown_within(drain)exists so the test can use a short wait;shutdown()keepsRUNNING_DRAIN(5 s).P3: the startup wait covers every phase
grace.rsnow hasNOTES_DRAIN = calternal_notes::RUNNING_DRAIN.STARTUP_LOCK_WAIT = LONGEST + NOTES_DRAIN + SETTLE, which is 30 + 5 + 5 = 40 s, all derived.SETTLEnow explicitly covers the closing work and the blocking pool finishing before exit.Tests
Both re-review repros are now permanent tests, and both fail on
d4225a8(run in a temporary detached worktree with its own target dir, both since removed):BeforeWritepast a 200 ms drain. Ond4225a8the port usedshutdown(), which waits out its 5 s drain the same way. After release, the create is refused and no file appears.t.holdis held pastengine.shutdown(200ms), which returns false. After release, the action is refused and the journal still has 0 entries.t.holdnow take turns through a mutex.core::drainalso assertsgave_up()after a timed-out close.Gates (verbatim)
The clippy run took 0.30 s because the same sources had already been checked before the commit (
Finishedwith exit 0, no warnings).Review of
d4225a8..690f394. Verdict: merge.after=[]: noLate.md, and the create returns an error. The engine action held pastshutdown(200ms)leaves the journal atbefore=0 after=0.mem::forgetinshutdown_server). Tests useshutdown_server_and_release.STARTUP_LOCK_WAITis now 30 + 5 + 5 = 40 s, derived ingrace.rs.writes_closedis set only after the Home's final join.gave_upis set only whenclosetimes out. The list stores goquery_onlyonly insideNotes::shutdown.cargo test --workspace --no-fail-fast861 passed, 0 failed · the two storage_startup restart tests 100×: 0 failures.storage_startuptest binary runs,single_root_upgrade_backup_split_cache_delete_and_rollbacksometimes fails withWouldBlockat storage_startup.rs:331. In 40 interleaved runs each,d4225a8failed 2 times and690f394failed 3 times (the binaries have different hashes). It never failed when run on its own (400+ runs). My guess is a test harness race: lock fds briefly inherited by servers that parallel tests spawn. Worth a follow-up issue.Landed in train AU, #669.
Train AU ran the full suite at
467a35f(run au1): fmt, clippy, workspace tests, the build, svelte-check, every Playwright project: admin 43, cr1440 313, cr390 251+195, wk1440 136+176+1, wk390 147+182+120, small 19. The one failure (pill-room.spec:309 webkit-1440, a web layout test; this train changes no web code) passed 3/3 on rerun.Contents (#664): shutdown is deterministic and bounded, and nothing writes to a Home after it. One Drain at every way into storage (executor, Notes::enter, Home); idle/half-sent admin and slow HTTP clients bounded by shared graces; cancelled startup scans release their waiters; finished task handles reaped; retired rooms joined; root locks held until process exit; late work refused at every write point; startup waits max grace + drain + settle (40 s, derived in grace.rs), with a clear error if another live server holds the Home.
Independent review: three rounds (do not merge -> do not merge -> merge with fixes -> merge). Final verdict on
690f394: merge. Edit path not slower (p95 0.96 vs 1.57 ms on a 10k-note Home, directional).Still open on #664: the whole storage_startup test binary occasionally hits WouldBlock (2/40 before, 3/40 after; 0/400 alone) - likely a test-harness race; follow-up.
#664 storage_startup race: handoff (WIP)
Branch
issue/664-startup-race(off origin/devc2b7a1a), head441ffc509123488823f668fd9bb50307fbf42520. The fix is committed, but its 200× proof has not been run. This is a handoff to Codex.Root cause (with evidence)
When the whole
storage_startupbinary runs, another test thread is starting a server (starts()→Command::spawn) at the same momentsingle_root_upgrade_backup_split_cache_delete_and_rollbackholdshome/.lockinsidestorage::re_pair.O_CLOEXEConly closes that copy atexecve, so until the child execs, the flock stays held even afterre_pairhas dropped its fd.storage::prepare(line 331) then gets WouldBlock.Instrumented failure: timestamps per thread, microseconds before the failing call, run 10 of a whole-binary loop under 2 burners:
A holder scan run right after the failure (
/proc/locksand every/proc/*/fd) found no holder: the copy had already gone away at exec, which fits a transient fork-window copy. Two separate diagnostic loops both failed at run 10, under twonice -n 19burners.Ruled out
DataLockopens through stdOpenOptions, which always setsO_CLOEXEC. No long-lived child keeps the lock; the copy lives only between fork and exec.Command::newappears only in tests andperf), and a starting server waits up to 40 s on WouldBlock anyway. This is a test-harness race.child.kill()pluswait()returns only after the kernel has closed its fds.shutdown_server_and_releaseordering and the 40 s startup wait: neither is on this path. The failing call is a plainstorage::preparewith no wait.Fix in progress (test only,
crates/calternal/tests/storage_startup.rs)static SPAWNING: RwLock<()>. Each child is started withspawn_settled(), which holds the write lock untilspawn()returns (after exec).prepare/re_pair/acquire_existingwrappers that first callsettle_spawns()(take and drop the read lock). Any spawn that forked while this process held a lock fd has therefore exec'd before the next lock attempt.cargo fmt --checkis clean. Not yet done: clippy,cargo test --workspace, and the 200× whole-binary proof under load. The run was stopped before it started, for this handoff.Repro / proof command
On origin/dev this failed within about 10 runs both times I tried. Expect 0/200 with the fix.
Next steps: run the 200× proof on
441ffc5, then clippy and the workspace tests, then merge through a train. Consider movingspawn_settled/settle_spawnsintocalternal-testkitif another test binary starts locking and spawning in parallel. Today only storage_startup does both in non-ignored tests.Starting the issue 664 proof on branch issue/664-startup-race. Base origin/dev SHA:
c2b7a1a063. Current branch head:441ffc5091.Review finding: crates/calternal/tests/storage_startup.rs had one ungated child start. The repair test closure used Command::status() at line 215, which spawns a process without holding SPAWNING. If it overlaps another test holding a root lock, that child can inherit the lock fd during fork and recreate the transient WouldBlock race. I am converting it to spawn_settled() and routing the direct startup-lock test calls through a settle wrapper. The existing lock exclusivity and held-past-startup-wait tests continue to cover real live locks.
Validation is queued behind three active build-slot jobs. The baseline test binary build has not started, and no gate result is available yet. The reviewed test change is committed as
fb1b4ed; I am waiting for a slot under the host policy.Starting the persistent-history-failure shutdown follow-up on branch issue/664-shutdown-settle, based on origin/dev
c2b7a1a063. I read the #664 thread and #652 comment 64650. CLAUDE.md is absent from this worktree and its ancestor directories; I am following the approved job instructions and ADR 0020.Finding: actor.rs calls settle before dispatching Shutdown. On a persistent write failure, refuse(Shutdown, error) does nothing and handle returns false, so RoomHandle::shutdown waits forever. The closing path already retries settle and save, and save itself requires durable history before writing the file. I chose to exempt Shutdown from the initial settle, keeping the existing closing attempts and their error logs. This avoids cancelling file work or declaring an unpersisted update saved. The regression uses a page quota on the history writer connection, checks shutdown against the five-second settle budget, checks storage-lock reacquisition and writer closure, drains the client messages to reject a false Saved, and replays the pending client state after restart. Focused validation is queued through the required build-slot wrapper.
Focused validation passed on the fix:
test tests::shutdown::shutdown_finishes_when_history_writes_keep_failing ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 325 filtered out; finished in 1.82s
The page quota rejected three independent oversized history appends before typing began. Shutdown completed within the five-second deadline, joined the history writer, and allowed the next storage-lock acquisition. The client only received its earlier successful Saved check; history and the note file stayed unchanged for the failed edit. A new server then accepted the pending client replay and stored it exactly once before Saved. I am checking that the same test fails with the original actor before running the full gates.
The regression also fails with the original actor from base
c2b7a1a, with the new test and page-quota helper kept unchanged:shutdown finishes within the server's five-second settle budget: Elapsed(())
test tests::shutdown::shutdown_finishes_when_history_writes_keep_failing ... FAILED
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 325 filtered out; finished in 5.09s
original actor regression: exit 101 (expected failure)
The fixed actor has been restored. Full validation is now running in the same reserved build slot: formatting, clippy with warnings denied, the workspace tests, then the requested notes crash tests twenty times. No evidence files are being added to the repository.
Finished on branch issue/664-shutdown-settle. Head SHA:
5fadffcdf4.Shutdown now skips the initial read-command settle check. The actor reaches its existing closing path even if history cannot be written; that path still attempts settle and save, logs failures, and exits. No history-before-file or Saved check was weakened. Clients retain edits that were never acknowledged and replay them after restart, as required by ADR 0020. I chose this fix over task cancellation so outstanding file operations remain joined.
The permanent regression uses a quota on the history writer's SQLite connection. It proves three consecutive writes fail, then checks Notes shutdown and storage-lock release within five seconds, history writer closure, unchanged durable history and file text, no Saved for the failed edit, and exactly-once recovery from client replay. It passed with the fix and failed at the five-second deadline with the original actor from
c2b7a1a.Workspace totals: 862 passed, 0 failed, 5 ignored. Each of the 20 crash runs passed all 16 selected tests. All heavy commands used the required build-slot wrapper, the dedicated target directory, and cargo -j4. CLAUDE.md was absent from this worktree and its ancestor directories. No PR, merge or deployment was performed. Only product code and tests were committed; evidence stays in these issue comments.
Gate output below is copied verbatim from the run (result and exit lines):
Independent shutdown-settle review started. Reviewing branch issue/664-shutdown-settle in a detached worktree at
5fadffcdf4, base origin/devc2b7a1a063. No commits, pushes, merges or deployments. I will inspect shutdown, durability and replay guarantees and run the requested gates sequentially.Source review: the change only removes Shutdown from the initial read-command settle gate (crates/notes/src/room/actor.rs). Closing still calls settle and save, save still requires history before placing a file, and Saved still waits for the durable counter. Home shutdown joins room tasks before closing history; production keeps storage locks until process exit. These checks preserve the existing durability and no-writes-after-shutdown ordering. CLAUDE.md is absent from the worktree and its ancestor directories, as reported in comment 64677. Gates are queued through the shared build-slot wrapper. I am also checking recovery during shutdown and shutdown during bulk work.
Review validation is temporarily blocked on shared build capacity: all three build slots are held by other jobs, and the first gate has been queued for several minutes. No gate has run yet. I am keeping the prescribed wrapper and waiting; no other processes have been stopped. Static review is complete and the extra recovery, bulk-work and multiple-failing-room timing probes are prepared outside the repository.
Required crash gate finding on head
5fadffcdf4: runs 1 and 3 failed. Both report tests::fanout::a_crash_before_the_seed_is_durable_never_doubles_text timing out at crates/notes/src/tests/clients.rs:298:14: "the server never answered: Elapsed(())". Each failed run finished with "test result: FAILED. 15 passed; 1 failed; 0 ignored; 0 measured; 310 filtered out; finished in 30.03s" (run 3: 30.07s), exit 101. Runs 2, 4 and 5 passed all 16 tests. Formatting, Clippy with warnings denied, and the workspace tests passed. All commands used the required build slot and target directory. I am finishing all 20 runs and checking whether this timeout also reproduces with the original actor before attributing it to this change.Review scope finding: this head
5fadffchas merge basec2b7a1aand does not contain #652 merge-resolution commit9f8131a(git merge-base --is-ancestor exits 1). The reviewed history writer still uses std_mpsc::channel at history.rs:125, and rooms use mpsc::channel(4096), rather than #652's byte-bounded queues described in comments 64629 and 64650. The diff does not change queue or Saved logic, but a claim that the final #652 integration was tested here would be incorrect. That integration needs checking on the combined code. The shared origin/dev reference currently points to11a5d792a0; the reviewed merge base isc2b7a1aand HEAD remains unchanged. Targeted tests are still waiting behind the wrapper's active train priority.Confirmed P2: the fix removes the infinite Shutdown refusal, but closing work still exceeds the existing five-second SETTLE allowance with several full-history rooms. My temporary test created 12 notes, saved and joined them, capped the history writer at its current SQLite page count, verified an overflowing write fails, sent 64 KiB of typing plus a save check to each room, and awaited Notes::shutdown to completion. Verbatim result: "INDEPENDENT_REVIEW: 12 full-history rooms shut down in 17.267541498s; settle budget is 5s". No failed edit was acknowledged Saved. The test failed its elapsed <= 5s assertion. This is a remaining limitation of the fix, not a newly introduced regression: Home::flush_all and Home::shutdown visit rooms serially, while the actor retries settle for Flush and again for closing settle/save; rewrite_front sleeps 50/100/200 ms on persistent failures. grace::SETTLE is five seconds and contributes to STARTUP_LOCK_WAIT, so closing longer than its reserved allowance can overrun a restart handoff after preceding grace windows are used. Use a shared closing deadline or avoid serial repeated retries while retaining all writer joins and history-before-file checks. Add a permanent multi-room regression.
The other three independent probes passed: healthy pending typing is Saved and flushed across restart; lifting the history quota during shutdown stores the edit exactly once and releases Saved; a bulk job paused mid-create finishes that step, stores running progress for the rest, and writes nothing further after shutdown. Test summary: "test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 326 filtered out; finished in 17.91s". Temporary source probes were restored. The original-actor crash comparison is running next, sequentially in the same build slot.
Independent review finished. Head SHA:
5fadffcdf4. Final verdict: do not merge.Twelve rooms with persistent history failures took 17.267541498 seconds to shut down against the existing five-second settling allowance (evidence in comment 64725). The one-room hang is fixed, but serial repeated retries still overrun the closing budget. Healthy shutdown, recovery during shutdown, and shutdown during a bulk job passed. No false Saved or weakened writer-join ordering was found.
Required gates: fmt and Clippy passed; workspace 862 passed, 0 failed, 5 ignored; crash repetitions 18 of 20 passed. Runs 1 and 3 timed out in the first-open seed crash test (comment 64695). Five comparison runs with the original actor passed, so attribution remains unresolved. Final #652 bounded-queue integration is absent from this head and was not validated (comment 64698).
Full findings: /home/kayg/codex-jobs/shutdown-settle-review/findings.md. All temporary edits were restored; the worktree is clean. No commits, pushes, merges, deployments or issue closures. All heavy commands used the required slot wrapper, one job at a time, cargo -j4 and the dedicated target directory.
Gate output below is copied verbatim from this review's captured command, result and exit lines:
Starting the approved follow-up on branch issue/664-shutdown-settle at base/head
5fadffcdf4. I read the independent review. CLAUDE.md is absent from the worktree; checking available ancestor instructions. I will merge origin/dev, bound shutdown settlement and room concurrency, investigate the crash wait race, and run all requested gates sequentially through the shared build slot. Evidence stays outside the repository.Control evidence: the unmodified origin/dev storage_startup binary failed on run 13 under the two nice -n 19 burners. The failure was single_root_upgrade_backup_split_cache_delete_and_rollback at storage_startup.rs:331, where prepare(...).unwrap() received WouldBlock on home/.lock. The 200 run control is continuing before the fixed binary loop.
Merged origin/dev
756596cwith merge commit ddd0815 (no rebase);9f8131ais now an ancestor. The conflict resolution retains byte-bounded history/room queues and both Shutdown and RefreshMeta exceptions to versioned reads. Crash timeout finding: origin/dev already includesda87ee43c6, which fixes metadata refresh blocking sync behind an uncommitted seed. Its regression metadata_refresh_does_not_block_sync_behind_an_uncommitted_seed explicitly stalls that seed. This fix was absent from reviewed head5fadffc. I am validating that path along with the repeated crash gate. Shutdown changes remove the preliminary serial flush, close at most 16 rooms concurrently, settle once in the closing path, and skip file save after failed settlement. During shutdown, a failed history retry has no backoff or requeue; all actors and writers are still joined.Validation is temporarily blocked on shared build capacity: the targeted test wrapper has not acquired a slot yet, and all three build-slot locks are held by other jobs. I am leaving those processes alone and waiting in the approved wrapper. Source edits and regressions are ready; no gates have been claimed as passed. The public flush_all API is retained with bounded concurrency, while shutdown avoids calling it before each room closes.
First targeted run passed both multi-room regressions and the merged stalled-seed metadata regression. The multi-room cases await the complete Notes shutdown, including writer joins, before measuring; then check unchanged files/history, no false Saved, storage lock reacquisition, writer closure, and exactly-once durable replay of every room after reconnecting twice. Output, verbatim:
The controlled old/fixed read-predicate comparison and all required gates are now queued as one sequential build-slot job.
Crash timeout cause confirmed by a controlled comparison. The reviewed head and its merge base classify RefreshMeta as a versioned request. When initial list reconciliation sends that command after the first join but before the client sync round trip, the actor waits on the deliberately stalled seed and cannot handle sync. The test waits for a server answer that can never arrive. This is not caused by the Shutdown exception: it is the pre-existing read predicate, already fixed on origin/dev by
da87ee43c6. The merge keeps that fix. No fixed sleeps or increased answer timeout were added.I temporarily restored only the old read predicate, ran the deterministic stalled-seed regression, then restored the source in a finally block and reran it. Output, verbatim:
Old predicate:
Merged predicate:
Formatting and Clippy passed. The workspace suite and required repetitions are running sequentially in the same held slot.
Finished and pushed issue/664-shutdown-settle at
cd856d2b63.Merged origin/dev
756596cwith merge commitf921688f08. The merge retains9f8131aand its byte-bounded queues. Both new commits end with the requested attribution trailers. The worktree is clean.Shutdown closes at most 16 rooms together. It does not flush all rooms before closing them. Each closing actor settles once and saves only after that succeeds. A failed shutdown retry has no backoff or extra queued retry, and an interrupted existing retry cannot be repeated through closing. Actors and both writers are still joined before shutdown returns. The public flush_all API also uses bounded concurrency.
The permanent regressions cover 12 and 100 full-history rooms, unchanged files and durable history, no false Saved, joined history writer, storage lock reacquisition, and exactly-once durable replay after reconnecting twice. A healthy-shutdown regression covers Saved and file persistence of pending typing. Across the ten required repetitions, 12-room closes took 1.462132–2.673677 ms and 100-room closes took 4.379342–6.158640 ms. Both are below the five-second allowance. Measurements await the entire close rather than cancelling it at a timeout.
Crash timeout cause: metadata reconciliation could put RefreshMeta between joining and the client's sync round trip. The old predicate waited for the deliberately stalled seed, blocking sync forever. The reviewed head and its merge base share this predicate. origin/dev already fixes it in
da87ee43c6; the merge preserves that fix. A controlled old-predicate regression failed, and the restored merged predicate passed (comment 64742). No fixed sleeps or increased answer timeout were added. The required crash selection passed 30 times, each with 18 passed and 0 failed.Gate summary, verbatim:
Required gate command, completion, result and exit lines copied verbatim from gate-summary.txt:
Evidence and full logs remain outside the repository at /home/kayg/codex-jobs/shutdown-settle-finish. No evidence artifacts were committed. No PR was merged, nothing was deployed, and the issue remains open.
Independent re-review started. Worktree is detached at
cd856d2b63; comparison base is5fadffcdf4. I will rerun the 12-room and 100-room probes, recovery and bulk probes, workspace gates, and notes crash tests 30 times. No commits, pushes, merges or deployments.The independent re-review is waiting for a local build slot. All three slots are held by other jobs; no gate has run yet. I have not interrupted those jobs. Source review confirms
9f8131ais an ancestor and the room and history byte reservations remain in place. The closing path uses a JoinSet limited to 16 rooms and still joins actors before both writers. Dynamic checks are pending slot availability.Full origin/dev control result: origin-dev: failed 12/200. Failures included the previously reported WouldBlock on home/.lock (first at run 13); the fixed binary loop is now running under the same two burners.
Correction to the previous status: the first fixed-loop executable was byte-identical to origin/dev (both SHA-256 b5d415984bb9e2e582a383b965433956cd15a56407f3bc544f4b479a8faddc3e), because the two worktrees reused the same Cargo target artifact. The run 16 failure therefore does not test the fix. I am stopping that invalid loop and will rebuild the fixed binary with an isolated target cache before rerunning the fixed 200 run proof.
Independent finding on
cd856d2: shutdown can panic a room that is already saving while newer typing fails history. My probe starts a healthy Flush, pauses DuringPrepare, limits the writer to its current page count, types 64 KiB and sends a save check plus sync, then starts shutdown. The actor panics in tokio oneshot.rs:1291 with "called after complete"; the Flush finishes with Internal / "Notes is shutting down" while its prepare remains paused. No false Saved was seen for the newer typing. Source: rewrite_all leaves a consumed receipt when the new shutdown latch stops retrying (pipeline.rs:358-367), but during_file_io still calls next_durable without a shutdown/latch guard (save.rs:84), unlike the top actor loop. The probe fails its assertion that the paused file work remains joined. Repeating without instrumentation and comparing the parent pipeline now. Separate independent probes passed: 12 failing rooms closed in 1.935149 ms, 100 in 5.625235 ms, unchanged files/history, repeated exactly-once replay, healthy close, bulk-job shutdown, and observed peak concurrency exactly 16 with 20 paused healthy saves. The original delayed disk-recovery probe also fails because shutdown has already closed the writer before its 100 ms quota lift; coordinated recovery before closing settlement passes. Required gates are still pending.The actor panic reproduced in all three repetitions with no product instrumentation: each exited 101 after 0.11 s, with tokio oneshot "called after complete" and the paused Flush disappearing. Replacing only pipeline.rs with its
f921688parent version removed the panic and kept the paused Flush alive; that initial comparison still failed a stricter assertion requiring a successful Flush under SQLITE_FULL, so I am separating the join assertion from that unrelated expectation. The crash-timeout explanation is supported by a controlled predicate comparison: removing only RefreshMeta from the history-wait exemption makes metadata_refresh_does_not_block_sync_behind_an_uncommitted_seed fail after 2.01 s; restoring the merged predicate passes. This is a real blocked-sync cause, not a longer timeout masking load. Fmt and Clippy with warnings denied have passed; workspace and the 30 crash repetitions are running.Corrected binary evidence: after clearing the Cargo package artifacts, the fixed binary had a distinct SHA-256 (274c63456024a767d2f9e88e694040617ea954be7033fcf08f163fc9e8210369) but still failed on run 11 at storage_startup.rs:381, the prepare(...).unwrap() immediately after re_pair, with WouldBlock on home/.lock. The settle-only barrier therefore has a remaining gap while the synchronous lock operation runs. I am stopping this failed loop and changing the synchronous wrappers to hold the shared read guard across each lock operation.
Independent re-review required gates completed on
cd856d2b63. Fmt, Clippy with warnings denied and workspace tests passed. All 30 notes crash repetitions passed, with 18 passed and 0 failed in each. This does not clear the separate reproducible live-file-I/O actor panic reported in comments 64754 and 64758.Verbatim command, completion, result and exit lines from this review's gate-summary.txt (full output remains in the review directory):
All required independent gates are complete and passed; verbatim result lines are in comment 64763. The final focused lifecycle comparison is waiting for a local build slot, with all three slots occupied by other jobs. No other job has been interrupted. The reproduced live-file-I/O actor panic remains a merge blocker. Source is currently restored; final report and summary will include the focused parent comparison once it runs.
Additional evidence from the valid fixed binary: run 66 passed single_root_upgrade_backup_split_cache_delete_and_rollback, but the whole test binary failed legacy_history_read_only_and_invalid_state_are_refused at storage_startup.rs:310 because starts(&data, /sys/calternal-state, true) unexpectedly returned healthy. This is not the lock race; I am checking whether the invalid-path assertion can be fooled by the test port handoff or host state.
Update: origin/dev advanced during validation, so I merged its current tip
756596c958into issue/664-startup-race (merge commit8ab862fde5). The run 66 health response was not from a server that could write /sys: /sys/calternal-state is absent and /sys is read-only. I added a Linux test-helper check that accepts health only when the child process owns the listener socket. The full control had already shown origin-dev: failed 12/200; the fixed loop is being rerun on the merged branch.Independent re-review finished on
cd856d2b63. Final verdict: do not merge.The previous timing failure is fixed: my 12-room close took 1.935149 ms and 100-room close 5.625235 ms. Bounded concurrency (observed 16), no false Saved, repeated exactly-once replay, healthy flush and the bulk-job probe passed.
9f8131aand byte-bounded queues are preserved. The RefreshMeta explanation is supported by the controlled old/new predicate regression. All required gates passed: fmt, Clippy, workspace (919 passed, 7 ignored), and 30 crash repetitions (18 passed each). Verbatim gate output: #664 (comment)Blocker: a room already preparing a file can panic with "called after complete" when newer typing fails history during shutdown. Three uninstrumented reproductions failed. The focused lifecycle regression fails on the head and passes when only pipeline.rs is replaced with the
f921688parent version. The new shutdown early return leaves a consumed receipt, and during_file_io polls it again. Guard that loop without cancelling frozen file work, and add the regression.The exact old disk-recovery probe also fails because its 100 ms quota lift occurs after the writer has closed; coordinated recovery before final settlement passes. This is a disclosed change in retry policy, separate from the actor panic. Full report with verbatim gate outputs and probe evidence: /home/kayg/codex-jobs/shutdown-settle-review2/findings.md. Source is restored and git status is clean. No commits, pushes, merges or deployments; the issue remains open.
Starting round 3 on branch issue/664-shutdown-settle, base
cd856d2b63. I will give shutdown settlement failure one owner, make completed receipt reuse impossible, preserve joining of frozen file I/O, and add the live-save reproduction and randomized state-machine coverage before running all required gates. CLAUDE.md is absent from this worktree and its parent directories; I am following the approved job instructions and repository docs.Finding: all three receipt-consumption paths could retain a completed oneshot (await in next_durable, try_recv while draining a batch, and retry await). The change now removes the Option on completion and preserves it when a select cancels a pending await. One settlement state transition in landed owns shutdown failure; both actor loops consult that state, and submission stops after failure while frozen I/O remains awaited. The live-save regression synchronizes on that transition and forces another sync while preparation stays paused. The old delayed-recovery probe is being made a permanent test expecting history writer stopped after close, followed by client replay; shutdown intentionally does not keep the writer alive for later disk recovery.
Validation is currently waiting for a shared build slot; all three prescribed locks are occupied by other jobs. Only one build-slot job from this task is queued, and no other processes have been interrupted. Product changes and permanent tests are ready; I will continue through all gates when a slot opens.
Validation is still blocked on the shared build scheduler. A test train is now active, so the prescribed wrapper gives it priority. I am leaving the runner queued without bypassing the scheduler. No build or test from this round has started yet; the implementation and permanent tests remain uncommitted while validation is pending.
Finished on branch issue/664-startup-race.
Head:
8ab862fde5Merged origin/dev at
756596c958. The test-only spawn barrier now covers synchronous storage lock operations, so test children cannot inherit a held lock during another test's lock attempt. A live server holding the lock still causes the lock attempt to fail. The startup helper also verifies that the child owns the health listener.The origin/dev control without the fix failed 12/200. The fixed whole storage_startup test binary passed 200/200 under two nice -n 19 CPU burners.
Gate output:
fixed: failed 0/200
cargo fmt --check: exit 0
cargo clippy --workspace --all-targets -j4 -- -D warnings: exit 0
cargo test --workspace -j4 --quiet: exit 0
The local gate runner never started because the shared slots and then the priority train remained occupied. The perf VM lock became available, but it has only 1.7 GiB free (99% used), so I did not build there. Staging is idle at 49% disk use; I am preparing an isolated test checkout under /var/tmp/codex-shutdown-settle-round3-20261023 with Rust 1.99.0 and a private cargo cache. Tests will run as nobody, use only their private data, and leave incremental output disabled to stay below 60% disk. Remote commands are exempt from the local slot rule in the approved job instructions. No service or deployment is changed. Only this task’s recorded, still-queued local wrapper was stopped.
Staging validation started after source archive SHA-256 matched (61b42db66017d11d41142f014c8287907322b8b4ffc06b2fc7f5b84b11e774c5). Disk use after setup is 55%. The first attempt passed fmt but stopped before product compilation because the copied Rust toolchain’s linker wrapper pointed to a local Nix store path. I corrected only the private toolchain wrapper to invoke its bundled rust-lld with the staging loader, retained the failed environment log, and restarted the serial gates. No product test result is being claimed from that attempt.
The first source check found a compile error in the new replay helper (an awaited Arc used directly at a &Home argument). I bound the Home first, synchronized that test file to staging, and reran the checks. Product compilation and test-target linting now pass without warnings. The workspace test build is running.
The live-save shutdown regression passed in the workspace run, as did the late-recovery expectation. The randomized test found a fault-injection setup race, rather than another actor panic: its quota restoration was rolled back when grouped with a concurrently failing Flush. The shrunk actions were [FailHistory, FailHistory, Type(true), ReleaseFile, Flush, Type(true), FailHistory, RecoverHistory, Type(true)]. I am making quota configuration a separate test-only writer transaction, using the same transaction splitting already used for writer pauses. I also added a durability check before lifting the quota so recovery cannot hide an earlier premature Saved. The failed workspace output is retained outside the repo.
The focused run passes after isolating test-only quota configuration. It includes the live-save reproduction, late recovery after writer closure, and 500 generated state-machine cases with durability checks before recovery and after shutdown, five-second closing assertions, and repeated restart replay. I removed only explicitly named obsolete binaries from this job’s private staging cache; disk use is now 57%. The full serial gate run has restarted.
The next randomized run found a real recovery bug beyond the spent receipt: a file can be placed while its history promotion fails, leaving the live base cache at the previous file. A later closing save then merges its own frozen file as an outside edit. The shrunk sequence used DuringPlace, then [ReleaseFile, FailHistory, Type(true), ReleaseFile, Type(true), Flush, RecoverHistory, Type(true), Type(false), Type(false)]. After restart the body had one extra frozen snapshot line; the five machine edits were otherwise unchanged. This failed exact-body equality, so it is not being relabelled as a pass.
I am retaining a placed save’s completion until promotion succeeds, advancing the known file base as soon as placement is confirmed, and finishing pending promotion before another save or outside merge can replace its pending row. A deterministic promotion-failure regression is also added. The client replay and shutdown failure policy remain required.
The placed-save completion change passed the focused four-test run, including the deterministic promotion failure (with and without an actual outside edit) and 500 generated cases: 4 passed, 0 failed in 92.96s. I then refined the completion state to retain only small metadata on failure; retries reconstruct text from the already-kept frozen base, while healthy saves reuse their existing text buffer. This avoids retaining another whole-note string through a history outage.
The full rerun passed fmt and Clippy, then stopped earlier in the existing notes_live integration test at its HTTP helper read_to_end with ConnectionReset, before joining a room. That failure is retained and I am checking 20 focused repetitions before rerunning the full gates. No timeout or expectation has been relaxed.
The existing notes_live integration target passed all 20 focused repetitions without changes to its source or expectations. Its earlier failure was in the startup HTTP health probe (read_to_end returned ConnectionReset), before the changed room code was reached. I retained that failed full-run log and all focused logs, and restarted the requested serial gates. The temporary duplicate build directory from focused runs was removed by its literal private path; staging is below the 60% disk limit.
The full workspace run passed with the promotion fix: 923 passed, 0 failed, 7 ignored. Before completing the repeated gates, I strengthened the state-machine invariant so actor panics are recorded even when shutdown joins discard task errors. This observer is test-only. A temporary injected panic at Cmd::Shutdown made the property fail as expected; actor.rs was restored byte for byte, and all 1,060 source files were checked against the local worktree before restarting the final gate train.
I allowed the active Cargo command to finish before stopping only the recorded scheduler. I also stopped only the recorded private test server left by the earlier failed startup health probe; its executable and data directory both belonged to this staging scratch checkout. No other processes were interrupted. All required gates are now rerunning from the beginning with the stronger panic check.
The final-source workspace gate passes with direct actor-panic observation enabled. The four shutdown tests passed within it, including 500 generated cases. The serial runner has moved on to the required crash repetitions, then 20 regression/property repetitions and ten runs of both many-room cases.
The final-source notes crash gate passed all 30 repetitions, with 18 crash tests in each run. The four shutdown regressions and the 500-case state machine are now running for the required 20 repetitions (10,000 generated cases). Staging remains at 57% disk.
Committed the final source as
0ca023cd1eon issue/664-shutdown-settle; the worktree is clean. The commit includes only product code and permanent tests, with the requested trailers and the changed delayed-recovery expectation. The ongoing gates use the same 1,060 source files (manifest SHA-256 f8ad5f97425f836aa243efac424b404c4dc732bea97cd4f1fe194e0e74115cc7). The remaining randomized repetitions and many-room repetitions are still pending before push and PR creation.The regression/property gate is halfway through: 10 of 20 repetitions passed, covering 5,000 generated cases on committed head
0ca023cd1e. The four regressions pass in every repetition so far. The final-source workspace and all 30 crash repetitions have already passed; many-room repetitions run after the property gate.The final regression/property gate has passed 15 of 20 repetitions: 7,500 generated cases, with all four regressions passing each time. No source changes have been made after commit
0ca023cd1e.Finished round 3. Pushed head
0ca023cd1eto issue/664-shutdown-settle and opened PR #675: #675 . The worktree is clean.One owner now records shutdown settlement failure, every completed receipt is removed, and both actor loops stop consuming history after that failure while frozen file work still finishes. Placed saves also retain completion metadata until promotion succeeds, so a failed promotion cannot make a later save merge its own file twice. The commit explicitly changes the delayed-recovery probe to expect "history writer stopped" after close and recover retained typing through client replay.
Permanent tests include the review reproduction, deterministic promotion failure with and without an outside edit, the late-recovery expectation, and a real-room state machine. Direct actor-panic observation was verified by an injected-panic negative check, after which the source was restored. All 1,060 source files matched the committed worktree before and after the final gates (manifest SHA-256 f8ad5f97425f836aa243efac424b404c4dc732bea97cd4f1fe194e0e74115cc7).
The final gates ran serially on the isolated staging checkout as nobody using Rust 1.99.0. The private checkout and build cache have been removed; staging is back to 49% disk use. Full logs, including earlier failed attempts and the negative check, remain outside the repo at /home/kayg/codex-jobs/shutdown-settle-round3/evidence . No evidence or artifacts were committed.
Final gate output, verbatim:
The many-room test wall times include setup and restart replay. These shutdown measurements await complete Notes::shutdown, including writer joins, and are below the five-second allowance. Measurement lines from all ten runs, verbatim:
Starting independent shutdown review round 3 for #664. Worktree is detached (no branch) at
0ca023cd1e. Comparison basecd856d2; merge base with current local origin/dev756596c958. I will rerun all previous probes, workspace gates, crash tests 30 times and the new property test 10 times. No commits, pushes, merges, deployments or changes to PR #675.Round 3 runtime checks are waiting for the required local build slot. All three slots are occupied by the active E2E train; no review build or test is running yet, and I will not bypass the train or stop its processes. Read-only source review continues. Current remote dev is
5111711917(verified with git ls-remote); git merge-tree --write-tree HEAD origin/dev exits 0 with tree e9e68b31d60767021205de3848ca9a7b3988ed41, so the reviewed head merges cleanly without a checkout merge. The #652 integration commit9f8131ais an ancestor of HEAD. No verdict until the probes and gates complete.Round 3 source finding, pending runtime verification: pipeline.rs InFlight::receive and try_receive remove ready or closed receipts before returning; cancellation while pending keeps the receiver. landed is now the single owner of Settlement::ShutdownFailed. Both actor loops consult can_poll_history, and submit_waiting refuses further history after failure. The during_file_io loop retains and awaits its pinned file future, addressing the round 2 panic path without cancelling frozen work. save.rs retains the placed snapshot base and completion watermark until promotion succeeds; next save and outside merge finish that promotion first. Saved remains gated by the durable counter, and pending history is awaited before file placement. Home still joins rooms before closing history and index writers. I found no additional defect in these paths during source review. This is not yet a passing test claim. The five-second allowance remains a measured target, not a hard cancellation deadline for arbitrary blocked I/O or unlimited Homes.
The train has completed and the required build-slot wrapper has admitted the round 3 review runner. cargo fmt --check exited 0; Clippy with warnings denied is now running. Workspace tests, 30 crash repetitions, 10 property repetitions, and independent probes follow serially. CARGO_TARGET_DIR is /home/kayg/Developer/calternal-target-shutrev. No review command bypassed the build slot.
Round 3 gate evidence so far: formatting and Clippy with warnings denied exit 0; workspace exits 0 with 923 passed, 0 failed, 7 ignored; all 30 notes crash repetitions exit 0, with 18 passed per run (540 executions). The first two new property repetitions each ran the exact real-room state-machine test with its configured 500 cases and exited 0. No prior crash timeout has recurred. Property repetitions and independent probes are still in progress. Selected output follows verbatim.
Round 3 independent probe findings: the previous actor-panic reproduction passes three consecutive repeats without temporary actor counters. The live Flush remains pending while DuringPrepare is paused; after release it returns an ordinary SQLITE_FULL error, shutdown completes, and the newer typing is never Saved. The committed deterministic regression additionally observes actor panics directly and replays retained typing twice after restart; it passes. Failed-promotion regressions with and without an outside edit also pass.
Independent 12-room and 100-room full-history closes take 2.196434ms and 5.215357ms, respectively, measured around complete Notes::shutdown including writer joins. Both leave files/history unchanged, withhold Saved, and replay each client state twice after restart without duplication. The 20-room healthy-close probe observes exactly 16 concurrent closing actors, waits for paused writers, and flushes every file. Healthy close and the paused first create of a 65-step bulk job pass; later bulk files remain absent.
The unchanged old delayed-recovery probe was rerun and fails with exactly "history writer stopped" when it lifts the quota 100ms after closing begins. That is the expected consequence of a prompt failed close, not evidence of lost acknowledged changes. Recovery coordinated before final settlement passes. The new late-recovery test correctly requires client replay after the writer has joined and verifies exactly-once text and durable Saved after restart. I agree with that expectation change; it must not be described as the old probe passing unchanged.
All required gates pass: workspace 923 passed / 0 failed / 7 ignored, notes crash tests 30/30 repetitions, new property test 10/10 repetitions at 500 cases each. Every temporary probe edit has been restored; all 1,060 tracked file hashes match the initial manifest and git status is clean. Remote dev advanced during the train to
dadc7a26e9; the reviewed head still merges cleanly (merge-tree exit 0, tree38e7ac9222). The #652 integration commit remains an ancestor. Full findings and final gate output follow in the finish comment.Independent round 3 review complete at head
0ca023cd1e. Final verdict: merge.No remaining blocking shutdown defect found. The previous live-save panic reproduction passes three repeats without temporary actor counters; 12/100 failing rooms close in 2.196434ms / 5.215357ms with safe Saved and exactly-once replay. Healthy close, early recovery and the bulk probe pass. The old delayed-recovery probe fails with "history writer stopped"; the new expectation is correct after a joined writer, and its replay regression passes. #652 is present and its byte budgets/Saved contract remain intact. HEAD merges cleanly with current dev
dadc7a26e9. All 1,060 tracked file hashes are restored and the worktree is clean; no commits, pushes, merges, deploys or changes to PR #675.Required gates all pass: workspace 923 passed / 0 failed / 7 ignored; crash tests 30/30; property test 10/10 at 500 cases each. Findings: /home/kayg/codex-jobs/shutdown-settle-review3/findings.md. Full logs are outside the repository in that directory. The allowance remains a measured target rather than a universal cancellation deadline for arbitrary blocked I/O.
Gate result output follows verbatim (compiler completion, test result and exit lines; full stdout/stderr is preserved in the external logs):
Landed in train BF, #677.
Train BF ran the full suite (run bf1, dev
dadc7a2+ issue/664-shutdown-settle0ca023c+ issue/664-startup-race8ab862f): fmt, clippy, workspace tests, build, svelte-check, every Playwright project. Rust all green. Browser: admin 43, cr1440 330, cr390 266+214, wk1440 139+190, wk390 157+194+128, small 19; failures re-run 3x: review4-signout:242 (webkit-390) 12/12 passed, editor:59 (chromium-1440) 3/3, swipe-rows:126 (webkit-1440) 3/3. tooltips:12 at 320 px (webkit-390) fails 3/3 - the bottom tab layer intercepts the hover; this train changes only server code and one Rust test, so it is a dev UI issue from the phone chrome, tracked on #660.Contents (#664 follow-ups):
Independent review: 3 rounds (slow multi-room close + crash-test timeout ->
cd856d2; actor panic ->0ca023c); final verdict merge. Gates: crash tests 30/30, state-machine property 10,000 cases x20.Closing during the 26 Oct handover cleanup: Landed in train BF (#677).