Skip to content

Create the wake logs the lane launcher names - #170

Merged
shanebarakat merged 5 commits into
wandercom:mainfrom
CamTosh:fix/lane-wake-log-paths
Dec 4, 2026
Merged

shanebarakat merged 5 commits into
wandercom:mainfrom
CamTosh:fix/lane-wake-log-paths

Conversation

@CamTosh

@CamTosh CamTosh commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

tmux_lane.sh printed wakes land in …/tmux-lanes/wake.jsonl and …/events.jsonl, but events.jsonl didn't exist until the first wake (booking#199), so the path looked wrong. The launcher now creates both files, empty and mode 600, before printing their paths, so the paths it prints exist (owner-only, never truncated, never through a link or onto a FIFO). The printed line itself is unchanged. Nothing in the harness or runtime treats whether the file exists as meaningful.

🤖 Generated with Claude Code


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

tmux_lane.sh said wakes land in events.jsonl before that file existed
(booking#199). It now creates both logs, empty, before naming them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@adaptcom adaptcom 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.

Confidence Score: 4/5

Summary

Pre-creates tmux-lanes/wake.jsonl and events.jsonl (mode 600) before the launcher prints their paths. Failure-tolerant one-liner; no harness reader keys on existence or emptiness, and launch/qualify/wake tests pass. Low risk.

Important Files Changed

File Overview
harness/tmux_lane.sh Touches both wake logs under umask 077, then prints paths with new parenthetical

Reviewed 2488390...ecb0476 · ↻ Re-run review · View in Adapt

Comment thread harness/tmux_lane.sh Outdated
echo "tmux-lane: wakes land in $TMUX_ROOT/wake.jsonl and $ROOT/events.jsonl"
# Name only files that exist: an empty log means no wake yet, not a wrong path.
(umask 077; : >> "$TMUX_ROOT/wake.jsonl"; : >> "$ROOT/events.jsonl") || true
echo "tmux-lane: wakes land in $TMUX_ROOT/wake.jsonl and $ROOT/events.jsonl (empty until the first wake)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

events.jsonl is the run-wide log (refusals, fresh-session, blocking receipts, seat events) and is often non-empty at launch; condition the "(empty until the first wake)" text on [ -s ] or soften it.

Comment thread harness/tmux_lane.sh Outdated
[ -z "$WALL_CAP_S" ] || echo "tmux-lane: capped at $((WALL_CAP_S / 60)) min wall clock${SPEND_CAP:+ (\$$SPEND_CAP at \$$RATE/h)}"
echo "tmux-lane: wakes land in $TMUX_ROOT/wake.jsonl and $ROOT/events.jsonl"
# Name only files that exist: an empty log means no wake yet, not a wrong path.
(umask 077; : >> "$TMUX_ROOT/wake.jsonl"; : >> "$ROOT/events.jsonl") || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

>> follows symlinks while every harness writer of these files uses O_NOFOLLOW; guard with [ -L ] (or reuse the Python writer) so the launcher never creates a symlink target.

…y claim

events.jsonl is the run-wide log and is often not empty at launch, so the
launcher no longer says it is. It creates each log only when the path is
not a symlink, as every writer of these logs refuses one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamTosh

CamTosh commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in bb30f2d:

  • Each log is created only when its path isn't a symlink.
  • The "(empty until the first wake)" text is removed, since events.jsonl is the run-wide log.

The earlier CI failure was test_policy_custody::test_real_socket_round_trip…, a socket test unrelated to this change.

@adaptcom review

@adaptcom

adaptcom Bot commented Dec 4, 2026

Copy link
Copy Markdown

I checked bb30f2d and both earlier findings are fixed. Score is 5/5 with no remaining findings.

  • Symlinks: each log is now created only when its path isn't a symlink. I tried it with events.jsonl as a symlink: no target file was created, wake.jsonl came out empty with mode 600, and the loop exited 0 under set -euo pipefail.
  • Message text: "(empty until the first wake)" is gone, so the message no longer gets the run-wide events.jsonl wrong. bash -n passes.
  • CI: I didn't re-run test_policy_custody. A socket test failing has nothing to do with this one-file shell change.

↻ Re-run review · View in Adapt

The creation guard skipped only symlinks, so an existing FIFO at wake.jsonl or
events.jsonl was opened and the launcher hung at its last step. Create the file
only when neither -e nor -L holds, and open it under noclobber: bash then uses
O_CREAT|O_EXCL for an absent path, so nothing that appears after the check (link,
FIFO) is followed or opened. Existing files are never truncated, a new file is
owner-only, and any failure leaves the launch successful. CHANGELOG ### Fixed line
added for the user-visible fix.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
Through the real tmux_lane.sh launch on an ignited run (Lanes fixture,
stub tmux):
1. a fresh launch names <run>/tmux-lanes/wake.jsonl and <run>/events.jsonl
   on its output and both exist as regular files; a log the launch created
   is 0600. The wake path is where the watcher writes wakes (Watched and
   Lane fixtures), so the launcher must name that file. If ignition already
   made events.jsonl, its mode falls under the existing-log contract.
2. dangling symlinks at both paths: launch succeeds, neither target created.
3. existing logs (0640, with rows) keep their rows as a prefix and their
   mode; appending is allowed because the launch may record itself.
4. a FIFO at the wake path: the launch returns within a bound. On timeout the
   test opens the FIFO read-write to release the blocked launcher, then fails.

Decision: the FIFO case asserts completion only, not a return code; the brief
states no disposition for it.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
@shanebarakat

Copy link
Copy Markdown
Collaborator

Verified live: tmux-lanes/wake.jsonl is created empty with mode 600 before the launcher prints its path. Every reader of events.jsonl (watchdog.py, preflight.py, postmortem.py, consume_block.sh, attention_gate.py) treats an empty file like a missing one, so existence carries no meaning. The full suite shows no new failures against main.

Nit: the description says the message now notes that the files stay empty until the first wake, but the printed line is unchanged.

@CamTosh

CamTosh commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for testing this live, Shane. Replies to your review, checked at 732a322:

  • Description vs printed line. Description updated: "The launcher creates the
    wake log files it names (owner-only, never truncated, never through a link or onto a FIFO),
    so the paths it prints exist. The printed line itself is unchanged." Drop the "empty until
    the first wake" sentence.

@shanebarakat
shanebarakat merged commit 5791a06 into wandercom:main Dec 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants