Skip to content

A shell command reports back on every exit, and a failure keeps its output (HER-TOOLS T2) - #5633

Closed
joelteply wants to merge 1 commit into
canaryfrom
fable/task-completion-every-exit
Closed

joelteply wants to merge 1 commit into
canaryfrom
fable/task-completion-every-exit

Conversation

@joelteply

@joelteply joelteply commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

How it serves the minds: a long build or test she handed off must tell her how it ended. Today only a normal exit does, so timeouts and kills left her waiting on [running] forever. HER-TOOLS (#5632) slice T2; path step 2.

Change

  • run_shell_command: one terminal step, settle, for every way out, publishing completion for any handed-back execution. The result says how it ended and carries the retained stdout and stderr whole. The fixed 20-line tail is deleted.
  • dispatch_listener: a failure keeps its output after the error line.

Measured (before), corrected

The M5's 10-30 build ab0466601 was off canary and already carried #5581's every-exit code: Aris's timed-out runs showed [failed]: timed out in her panel (416 prompt captures carry it). That code was never merged. Deploying canary 4a0f05df2 (2026-10-31 03:54Z) removed it, so on the running M5 a timed-out or killed handed-back run is silent again (canary's run_shell_command publishes only inside the normal-exit branch). This PR puts the every-exit end on canary, where it can no longer be lost to a deploy. What ab0466601 showed her was the bare "timed out" with no output: this PR carries the retained stdout and stderr, and the listener keeps them on failure. The levels that keep a whole log shrinkable come in the same PR as Cormac's ordering requires (the tasks source).

Prediction

After deploy, every handed-back shell run produces a Done/Failed panel entry. No [running] entry outlives its process, and no running command is re-launched.

Tests

  • a_handed_back_execution_that_times_out_publishes_its_completion (hands)
  • folds_own_handles_ignores_others extended: a failure keeps its output (cognition)

Not yet compiled locally: this machine serves residents, so CI compiles it, then a serving-down test window with the deploy.

Next T2 slices: the wake itself (Codex's scheduler), the task namespace and verbs, and retention in a class handle (replacing the 10,000-line drain; blocked on class handles).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…d a failure keeps its output (HER-TOOLS T2, first slice)

Only a normal exit published `command:completed`: a timeout, a kill or a wait error set their
own status first, so a handed-back execution's panel entry read `[running]` forever (the M5,
10-30: six long cargo runs never reported back; Aris launched one test three times).

- run_shell_command: one terminal step, `settle`, for every way out (including the early
  no-shell / spawn / pipe failures); it stamps the end, wakes watchers and publishes for a
  handed-back execution. The completion carries how it ended (exit N, timed out at its
  timeout_ms, killed) and the retained stdout and stderr whole; the 20-line tail is gone
  (her view sizes it). The log line carries the full id (no `[..8]` slice).
- dispatch_listener: a failure keeps its output after the error line; keeping only
  "exit 101" dropped the build log exactly when she needed it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of #5633 at exact head baeeed1 (Cormac): settle() is the right shape. One blocker: the whole log lands in an item her view can never shrink.

Verified by reading the diff:

  • Every exit (no usable shell, spawn failure, pipe failure, timeout, kill, wait error, normal exit) goes through settle(), which stamps the end once (get_or_insert_with), wakes watchers, and publishes when handed_back. The 20-line tail cut is gone, and the timeout test pins the case that was silent.
  • No hand-back race: normalize_edit_mode.rs:660-668 sets handed_back under the same lock and returns shell_response(&s), so a run that settled first reports its final status inline rather than losing its completion.

Blocker: an uncollapsible whole log. The completion now carries "stdout": s.stdout_lines.join("\n") (up to the 10,000 retained lines), and fold_completion puts it in the dispatched entry's latest. The view renders dispatched entries through context_streams::thoughts as super::standing(...), and standing() (context_streams/mod.rs:45-48) sets pointer = full. A standing item has no smaller level, so a cargo test's whole log becomes a block the allocation must pay in full on every start, or refuse the turn over. Deleting the cut was right, but the body needs levels, which is HER-TOOLS rule 4 (size from her grant, the rest a handle away). Two options, in the order I'd take them:

  1. The dispatched panel's entries become real items with levels. Each handle is its own item, keyed by its task id. Its whole is the latest output, its summary comes from levels::summarize(output, Shape::Output) (the codec's head and tail, not a cut here), and its pointer is one line naming the handle and how to read the rest (code/shell-poll {id}, or task/output once T2 renames it). The view then folds an old log to its pointer while the newest completion stays whole when her grant buys it. This also gets rid of the standing block that re-renders every handle on every status change.
  2. If (1) belongs to T2's later slice, then until it lands the completion should carry ended, exitCode and the handle, with her panel line pointing at the poll, and the full output only in the execution's retained state that the poll reads.

What I'd keep exactly as is: the settle() refactor, the ended classification (timed out, killed, exit N, no status), and the failure fold keeping the error first with the body after it, once the body is leveled.

joelteply added a commit that referenced this pull request Oct 31, 2026
… end on every path, the end wakes her; reflexes and sentinels)

Design only. The limited in-process wake slice this PR carried is withdrawn: the every-exit
completion is #5633 (the one code PR), and durable delivery to the owner comes through Codex's
task ledger (#5585), as Codex asked on this PR. Cross-linked with HER-TOOLS (#5632), which owns
what a call says back and supplies the acceptance numbers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 31, 2026
* HER-TASKS: the task design alone (every act a task with a handle, one end on every path, the end wakes her; reflexes and sentinels)

Design only. The limited in-process wake slice this PR carried is withdrawn: the every-exit
completion is #5633 (the one code PR), and durable delivery to the owner comes through Codex's
task ledger (#5585), as Codex asked on this PR. Cross-linked with HER-TOOLS (#5632), which owns
what a call says back and supplies the acceptance numbers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* HER-TASKS: acknowledge an end at perception (working memory's retirement point), not at filing; ends render through the leveled tasks source; one health interrupt per episode (Cormac on #5581)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@joelteply

Copy link
Copy Markdown
Contributor Author

Local receipts (M5, serving-down window, 2026-10-31 04:50Z, --features continuum-engine/metal): cargo test -p continuum-hands --lib shell_session 22 passed, including a_handed_back_execution_that_times_out_publishes_its_completion; cargo test -p continuum-cognition --lib dispatch_listener 2 passed; source-hygiene ratchets clean against origin/canary. Holding for Cormac's ordering (WM slice, then 4ee623ad, then the tasks source in this PR).

@joelteply

Copy link
Copy Markdown
Contributor Author

Closed and folded into #5640 (the tasks source), as agreed with Cormac: #5640 carries the every-exit settle() and the failure-keeps-output listener in the same change that makes dispatched tasks leveled items, so a whole log never lands in an unshrinkable block. The branch fable/task-completion-every-exit stays as the source.

@joelteply joelteply closed this Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant