Patch session metadata atomically by stable ID - #142
Conversation
4c67fb5 to
bf893c6
Compare
|
Independent review at exact
The narrow After correction, please rerun the focused metadata/event, atomic-write, spawn, GC, and race regressions. The previously reported completion failure is isolated and is not a blocker. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 706e4f5e4c
ℹ️ 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".
|
Addressed the independent review blockers in
Validation on the exact head: TypeScript build + typecheck passed; 8 focused files and 117/117 tests passed on aarch64-linux. The PR remains draft. |
Summary
metadata_changerecordspty execso they cannot overwrite a concurrent patch or same-ID replacementContract
pty metadata patch --id <stable-id>reads one merge-style JSON object from stdin:IDs are immutable and remain the authoritative lookup key. Display names are presentation metadata: they may be duplicated and changed without restarting the session. Name-based lookup succeeds only when the name resolves to one live session; ambiguous names fail and list the candidate IDs.
Display names must be non-empty, already trimmed, at most 160 Unicode scalar values, and contain no control characters or U+2028/U+2029. Slash and backslash are allowed.
Coherence boundary
The exact metadata patch operation, GC flapping transition, and
pty execcommand update acquire the event lock before the metadata lock and publish from the current generation. Orphan and abandoned reaps use two generation-checked leases: one before signaling and one after daemon shutdown/flush before cleanup. Busy, stale, failed-signal, and shutdown-timeout outcomes are reported without claiming a reap succeeded.The metadata file remains authoritative. Lifecycle events and metadata are not generally a cross-file transaction: for example,
session_exitmay publish before its exit metadata while that metadata lock is busy. A process crash or I/O failure between metadata and event files can still omit a notification because this change does not introduce a journal.pty execchildren receive an opaque generation owner token. Sessions started by an older build fail closed and need one restart before usingpty exec; no compatibility fallback can safely prove ownership.Validation
Exact combined-tree aarch64-linux proof at
0deb3f0:Earlier exact macOS proof against upstream
d5fabc3:tests/completions.test.ts; it reproduced unchanged on the exactd5fabc3baseline and is inheritedThe branch was merged with upstream
mainin2cc286e, followed by lifecycle hardening in706e4f5and review corrections in0deb3f0.Part of compoundingtech/st2#128.