Skip to content

fix: drop the headless branch bash job logs never took - #71

Merged
webmatze merged 1 commit into
mainfrom
fix/dead-headless-bash-jobs-dir
Aug 26, 2026
Merged

fix: drop the headless branch bash job logs never took#71
webmatze merged 1 commit into
mainfrom
fix/dead-headless-bash-jobs-dir

Conversation

@webmatze

Copy link
Copy Markdown
Owner

Closes #69.

bash_jobs_dir hatte zwei Antworten: das Session-Verzeichnis, oder ein Per-Prozess-Temp-Verzeichnis für einen Lauf ohne Session. Die zweite wurde nie erreicht.

Warum der Zweig tot war

@session_id startete mit dem Sentinel "headless", aber der einzige Aufrufer ist build_agent — und alle vier Aufrufstellen setzen unmittelbar davor die echte Session-Id, headless eingeschlossen (seit 25dfef6 „session names, continue, context breakdown" legt auch ein headless Lauf eine Session an):

Aufrufstelle @session_id gesetzt in
run_headless direkt davor
resume_headless direkt davor
run_plain_loop start_session_loop
run_tui_loop start_session_loop

Der Vergleich war also jedes Mal falsch, wenn er ausgewertet wurde. Der Temp-Zweig und die rm_rf-Zeile, die hinter ihm aufräumte, waren unerreichbar.

Was falsch dokumentiert war

Das README beschrieb genau diesen Zweig als geltendes Verhalten:

A headless run has no session, so its jobs use a per-process temporary directory that is removed with them.

Verifiziert an einem echten Lauf (Stub-Provider, isoliertes SMITH_HOME, eigenes TMPDIR): ein Background-Job unter smith run --yes schreibt nach ~/sessions/<id>/bash/bash-1.log, im Temp-Verzeichnis erscheint nichts. Der Satz beschrieb etwas, das seit einer Weile nicht mehr stimmte — und es war der Satz, den man liest, wenn man sein Log sucht.

Statt eines neuen Defaults

@session_id ist jetzt nilable und wird über einen Accessor gelesen, der wirft. Es gibt keinen Lauf ohne Session; ein Wert, der für eine einsteht, kann nur den Tag verdecken, an dem das aufhört zu stimmen. Der zweite Konsument — der Hooks-Runner — geht durch denselben Accessor und wird ebenfalls aus build_agent heraus gebaut, war also nie in Gefahr. Er hängt jetzt nur nicht mehr daran, dass der Sentinel rechtzeitig überschrieben wird.

Tests

  • crystal spec: 881 Examples, 0 Failures
  • crystal tool format --check sauber
  • End-to-End verifiziert wie oben beschrieben

🤖 Generated with Claude Code

`bash_jobs_dir` had two answers: the session directory, or a per-process
temp directory for a run without a session. The second one was never
reached. `@session_id` starts as the sentinel `"headless"`, but the only
caller is `build_agent`, and all four of its call sites assign the real
session id immediately beforehand — headless runs included, since they
have been opening a session since "session names, continue, context
breakdown". The comparison was false every time it was evaluated, so the
temp branch and the `rm_rf` that cleaned up after it were dead.

The README, meanwhile, presented that branch as current behavior: "A
headless run has no session, so its jobs use a per-process temporary
directory that is removed with them." Verified against a real run — a
background job under `smith run --yes` writes to
`~/sessions/<id>/bash/bash-1.log`, and nothing appears in the temp
directory. The sentence described something that had not been true for a
while, and it was the sentence anyone would have read before wondering
where their log went.

Rather than swap one unreachable default for another, `@session_id` is
now nilable and read through an accessor that raises. There is no run
without a session; a value that stands in for one can only ever hide the
day that stops being true. The other consumer, the hooks runner, goes
through the same accessor and is built from `build_agent` as well, so it
was never at risk either — it just no longer depends on the sentinel
happening to be overwritten in time.

Closes #69.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@webmatze
webmatze merged commit d745dc9 into main Aug 26, 2026
2 checks passed
@webmatze
webmatze deleted the fix/dead-headless-bash-jobs-dir branch August 26, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toter headless-Zweig in bash_jobs_dir; README beschreibt ihn als geltendes Verhalten

1 participant