Skip to content

fix(session-journal): recreate removed event log directories - #5219

Merged
thymikee merged 4 commits into
mainfrom
t3/5b656cfe
Nov 29, 2026
Merged

thymikee merged 4 commits into
mainfrom
t3/5b656cfe

Conversation

@thymikee

@thymikee thymikee commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Recreate missing session event log directories with bounded retries during append and rotation. Keep rotation recovery separate from queue handling. Document that full session directory loss resets cursor indices and requires discarding stored cursors.

Before / after

A file at the session directory path could surface as a rotation failure. Files at that path or at an ancestor now report a mkdir failure. If the directory disappears during either rotation rename, the two queued events are readable in order from cursor 0 after recovery.

Validation

CI is pending for 40bfd7e. CI owns tests and checks; no local tests or checks were run.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.70 MB 6.70 MB +550 B
Package (unpacked) 6.70 MB 6.70 MB +550 B
Package (download) 2.04 MB 2.04 MB +159 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 17.4 ms 21.6 ms +4.2 ms
CLI --help 38.8 ms 42.5 ms +3.7 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 958f303. The verdict and the full list are in the summary comment.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 40bfd7e

Since the review of 958f303: 0 new · 0 still open · 1 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a0c616cd955d).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 40bfd7e, and the code review found nothing that must change before merge.

Not blocking: each of these can be taken or left: after a missing-path error from rotation, could the stat probe be replaced by a recursive mkdir and one rotation retry, since a directory recreated before the stat resolves appears to drop the queued entry, and a removal inside the completeness check appears to be wrapped so that it is never retried; could one per-entry helper run prepare and append, then mkdir and repeat both once on the first ENOENT or ENOTDIR, replacing the two copies of that recovery; the file-in-the-way tests should pass without the fix, so a regression test would write one event, replace the directory or an ancestor with a file, write again and assert operation mkdir; every place that tells callers how to use cursors, such as the Node client docs, could state or link the reset rule in sessions.md, because a caller is not told when a reset happened (a log generation id or typed expiry would fit a separate issue); and path errors such as ELOOP or EACCES that are met before any mkdir now appear to report rotation instead of mkdir, which needs no change unless that label matters.

The earlier thread about the index restart is resolved, because sessions.md now documents the restart.

CI is green at this commit: Coverage, Integration, Smoke, Lint/Typecheck and Repo Guards succeeded, and Proof was skipped.

One Body rules run was cancelled, and another at the same commit succeeded.

Not verified here: no tests were run, so the behavior of the new tests on the base code was judged by reading it; the race windows and the ELOOP/EACCES labels were derived from code and not reproduced; filesystem error codes were checked on macOS only.

Nothing from this review blocks the merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 29, 2026
@thymikee
thymikee merged commit 00e4f41 into main Nov 29, 2026
22 of 23 checks passed
@thymikee
thymikee deleted the t3/5b656cfe branch November 29, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant