fix(issue-50): review findings of PR #56 on macOS
- admission: a `submit --dry-run` record is marked dry_run and is not an open job of its session (review 1e25cf2f F1) - create: the monitor-row adoption requires the row's server to be the one this create spawned on (review 1e25cf2f F2) - pane lock: retry only on contention (BlockingIOError); the docs say the flock lasts while any fd-9 holder (the claim shell and the shim) lives (review 66680d9d) - tests on macOS: real-herdr box HOMEs under /tmp (sun_path is 104 bytes), resolved paths, the fake claude reads non-canonical input (MAX_CANON 1024) and the pane is read unwrapped; lock holders exec their sleep so killing them frees the lock; the adoption tests name the server Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
1 parent
320aa9f7a0
commit
a9ffedac36
10 files changed
+75
-19
No files matched your search
@@ -533,9 +533,13 @@ running_same = [s for s in sessions if s.get('name') == name and s.get('status')
|
||||
# registered, with no job, for a pane created after this create began, is
|
||||
# this create's own pane - herdr keeps live names unique per server and the
|
||||
# preflight refused an older session of this name - so it is replaced, not
|
||||
# refused as a second live session.
|
||||
# refused as a second live session. Names are unique per server only, so the
|
||||
# row must be this server's (review 1e25cf2f F2: another server's row of the
|
||||
# name was replaced). The pane pid is no identity: it is the pane's foreground
|
||||
# process at the time it was read.
|
||||
def _adopted_own(s):
|
||||
return (s.get('last_visible_note') == 'auto-registered by monitor' and not s.get('delegate_job_id')
|
||||
and (s.get('herdr_server') or s.get('herdr_session') or 'default') == server_name
|
||||
and epoch.isdigit() and int(s.get('herdr_session_epoch') or 0) >= int(epoch) - 1)
|
||||
if running_same and all(_adopted_own(s) for s in running_same):
|
||||
print(f"NOTE: the monitor registered {name} while it was being created; that row is replaced by this one", flush=True)
|
||||
|
||||
Reference in new issue
Block a user