fix(store): resolve path-identity and watcher races behind base CI red - #1148
Conversation
macOS /var and /private/var are one directory. Two registrations of the same project differing only by that alias were rejected as DuplicateProjectAuthority; roots are now canonicalized before sort/dedup. Falsifiable with an explicit tmp/link alias.
path_identity_key folds Windows display syntax only, so Unix symlink aliases (/var vs /private/var, tmp/link vs tmp/real) were stored byte-exact and scoped session reads keyed on the canonical spelling returned zero rows. Session writes and the project-scope predicate now go through durable_project_path_key; the analytics subagent tree matches both the opened and canonical spellings so rows written under either alias are one project.
FSEvents can deliver callbacks after shutdown() has joined the watcher; the callback still held WatchState and marked it dirty. Classification, notify-failure marking, and pending reconciliation now no-op once the state is retired.
GIT_INDEX_FILE and GIT_OBJECT_DIRECTORY retarget fixture git the same way GIT_DIR does; clear them too, and surface stderr when a fixture git command fails.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86bd169bad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| query_params.push(Value::Text(project_selector.to_owned())); | ||
| let key_parameter = query_params.len(); | ||
| query_params.push(Value::Text(path_identity_key(project_selector))); | ||
| query_params.push(Value::Text(durable_project_path_key(project_selector))); |
There was a problem hiding this comment.
Match both path spellings in scoped session reads
On macOS for projects under /var, observation projection deliberately persists the public /var/... spelling while its project_key can be a typed project ID (canonical_projection.rs:65-84 and observation_projection/state.rs:1142-1169). This predicate now compares project_path only with durable_project_path_key(project_selector), which expands the selector to /private/var/..., so project-filtered counts and searches by path miss those sessions. Match both the opened and canonical spellings here, as the changed analytics route already does.
AGENTS.md reference: AGENTS.md:L130-L132
Useful? React with 👍 / 👎.
| session.session_id.clone(), | ||
| session.project_key.clone(), | ||
| path_identity_key(&session.project_path), | ||
| durable_project_path_key(&session.project_path), |
There was a problem hiding this comment.
Preserve non-path project sentinels on write
When the daemon's current directory contains a user directory, production profile-scoped sessions whose project_path is the sentinel "user" are canonicalized to an absolute <cwd>/user path here. This breaks the sentinel's byte-exact round trip and can cause Git-history backfill to treat a user-scoped session as belonging to the current repository; the same issue applies to "unknown" when such a child exists. Restrict filesystem canonicalization to established project paths and preserve non-path sentinels unchanged.
AGENTS.md reference: AGENTS.md:L162-L164
Useful? React with 👍 / 👎.
Inline replay must prove a missing target via the spool watermark instead of treating an empty spool as accepted_for_replay.
Performance Comparison
|
b9d96d0
into
codex/tracedecay-total-redesign-plan-reopened
Production-side root causes behind the red on the #707 tip (
9ca6759a8run 34317967355).fable/test-redsalready landed test-side isolation for the same symptoms; this PR carries only the defects that remain in shipped code, rebuilt on top ofea098cba8with duplicates dropped.fix(store):LocalProjectEnrollmentAuthorityV1compared rawPathBufs, so macOS/varvs/private/varregistered one project as two authorities (DuplicateProjectAuthority, dashboard graph tests). Roots are canonicalized before sort/dedup. Test: explicittmp/linkalias must equal the real root and must not be a duplicate authority.fix(sessions):path_identity_keyfolds Windows display syntax only; Unix symlink aliases were stored byte-exact while scoped reads keyed on the canonical spelling → zero rows (dashboard analyticssessions_read0 vs 5). Writes and the project-scope predicate now usedurable_project_path_key; the analytics subagent tree matches both opened and canonical spellings. Test: link and real spellings produce one stored key.fix(code-index): FSEvents can deliver callbacks aftershutdown()joined the watcher; the callback still markedWatchStatedirty. Classification, notify-failure marking, and pending reconciliation no-op once retired.fix(runtime-core): fixture git also inheritedGIT_INDEX_FILE/GIT_OBJECT_DIRECTORY; cleared alongsideGIT_DIR, and fixture failures now surface stderr.Dropped from the lane as superseded: the
DaemonEnginecfg gate (landed ase9fd69741), theretained_project_store_dbidentity compare (landed as7973458dc), the GitHub fixture blocking-socket fix (b0c40ee75), and an LSP initialize-write budget swap that the landed test-side fix made unnecessary.fix(mcp): inline projectless Hermes replay reported a receipt the concurrent replay worker had already committed asaccepted_for_replay, which the caller rejects (fail-if-flakyretargeted_client_profile_root_keeps_hermes_receipt_under_pinned_profile). When the target seq is absent from the spool, the replay now proves settlement through the spool watermark (replay.commit(seq)isOkiffseq <= committed_through) and reportsCommitted; a never-committed seq stays the typedspool_ack_conflict. NoExactDuplicatefabrication. RED→GREEN test; projectless suite 5/5 ×3 under--test-threads=8; Hermes module 6/6.Local: clippy
-D warnings --testson store-runtime, sessions, dashboard-api, code-index-runtime, runtime-core; enrollment alias test 1/1; durable path key test 1/1; worktree tests 15/15; git_watch shutdown and dashboard analytics tree runs in flight.