Child results arrive whole: final-message results, result files, no placeholder wakes #118

Merged
chad merged 2 commits from glen/full-child-results into main 2026-10-17 09:59:52 -04:00
Collaborator

Background harness calls and start_thread children reported back cut off. Reviews lost their findings, harness results read like a step log ("Now let's look at…"), and one wake was just [tool bash]. The plan of record is PLAN.md v7; Chad changed part C so full results go to files, not inline inspect text.

Changes

  • A. A harness result is its final message. The result is the last step's own text, not every step joined. If the last step had no text, it falls back to the last earlier step that did, with a note. Every harness task now ends with an instruction to finish on a real result. The stored task and the start event keep the raw ask.
  • B. Bigger limits. harness_calls.result is stored up to 60 k characters (was 2 k). One WAKE_DETAIL_CAP = 16_000 covers both harness and thread wakes (was 500 / 2 000). A cut wake points at the result file.
  • C. Result files. When a call or child finishes, its full result is written to <parent workRoot>/.sweatshop/results/<id>.md.
    • It's written only when the parent's sandbox is already bound, never inside a repo, and best effort: a failed write never blocks the wake.
    • The wake gives the path and size so the agent can grep or cat it. When there's no file, the wake says why: no bound sandbox or write failed.
    • The path actually written is recorded (result_file columns, migration 0052). inspect and the recovery sweep read that column, so they never report a file that doesn't exist.
  • D. No placeholder wakes. lastAssistantReport skips [tool …]-only rows. A turn that ran out of steps is marked on its last row (durable, so the sweep sees it too) and the wake says "ran out of steps". Child threads get 400 steps without a skill; the budget continuation stays skill-only.

Review (fresh eyes): verdict "ship"

The full report was written to a file, so it survived the old cut-off. All six findings were fixed in 4a549b6:

  1. should-fix: inspect guessed result-file paths, which could point at files never written (silent or cancelled children, failed writes, empty results). Fixed: the written path is recorded at finish time and read back as-is.
  2. nit: the character count reported the size before the cap. Fixed: it reports the stored size on both paths.
  3. nit: the "no bound sandbox" message also showed for failed writes. Fixed: the wake gives the actual reason.
  4. nit: no row limit on the report query. Fixed: LIMIT 1000.
  5. nit: an unguarded metadata parse in the wake path. Fixed: parsed safely.
  6. nit: inspect.resultFile and the result instruction had no tests. Tests added.

Plan deviation

The plan said "no migration". Finding 1 needed a durable record of the written path, so 0052 adds two nullable TEXT columns. Upgrade checked: a DB migrated on main, then on this branch, applies cleanly.

Verification

  • npm run typecheck && npm run lint && npm run test: 74 files pass (the reviewer's run: 714 tests).
  • Live check pending until after merge. Wakes come from the running app, so this needs a deploy. After merge: one claude call and one review thread with more than 2 k of output, checking that the wake arrives whole and the file matches the database copy.
Background harness calls and `start_thread` children reported back cut off. Reviews lost their findings, harness results read like a step log ("Now let's look at…"), and one wake was just `[tool bash]`. The plan of record is PLAN.md v7; Chad changed part C so full results go to **files**, not inline `inspect` text. ## Changes - **A. A harness result is its final message.** The result is the last step's own text, not every step joined. If the last step had no text, it falls back to the last earlier step that did, with a note. Every harness task now ends with an instruction to finish on a real result. The stored task and the start event keep the raw ask. - **B. Bigger limits.** `harness_calls.result` is stored up to 60 k characters (was 2 k). One `WAKE_DETAIL_CAP = 16_000` covers both harness and thread wakes (was 500 / 2 000). A cut wake points at the result file. - **C. Result files.** When a call or child finishes, its full result is written to `<parent workRoot>/.sweatshop/results/<id>.md`. - It's written only when the parent's sandbox is already bound, never inside a repo, and best effort: a failed write never blocks the wake. - The wake gives the path and size so the agent can `grep` or `cat` it. When there's no file, the wake says why: `no bound sandbox` or `write failed`. - The path actually written is recorded (`result_file` columns, migration 0052). `inspect` and the recovery sweep read that column, so they never report a file that doesn't exist. - **D. No placeholder wakes.** `lastAssistantReport` skips `[tool …]`-only rows. A turn that ran out of steps is marked on its last row (durable, so the sweep sees it too) and the wake says "ran out of steps". Child threads get 400 steps without a skill; the budget continuation stays skill-only. ## Review (fresh eyes): verdict "ship" The full report was written to a file, so it survived the old cut-off. All six findings were fixed in 4a549b6: 1. **should-fix:** `inspect` guessed result-file paths, which could point at files never written (silent or cancelled children, failed writes, empty results). Fixed: the written path is recorded at finish time and read back as-is. 2. **nit:** the character count reported the size before the cap. Fixed: it reports the stored size on both paths. 3. **nit:** the "no bound sandbox" message also showed for failed writes. Fixed: the wake gives the actual reason. 4. **nit:** no row limit on the report query. Fixed: `LIMIT 1000`. 5. **nit:** an unguarded metadata parse in the wake path. Fixed: parsed safely. 6. **nit:** `inspect.resultFile` and the result instruction had no tests. Tests added. ## Plan deviation The plan said "no migration". Finding 1 needed a durable record of the written path, so 0052 adds two nullable `TEXT` columns. Upgrade checked: a DB migrated on `main`, then on this branch, applies cleanly. ## Verification - `npm run typecheck && npm run lint && npm run test`: 74 files pass (the reviewer's run: 714 tests). - **Live check pending until after merge.** Wakes come from the running app, so this needs a deploy. After merge: one claude call and one review thread with more than 2 k of output, checking that the wake arrives whole and the file matches the database copy.
- harness result = the final step's own text (resultText), stored up to 60k; every harness task told to end on a real result
- WAKE_DETAIL_CAP = 16k shared by harness + thread wakes; clipped detail points at the file
- full result written to <parent workRoot>/.sweatshop/results/<id>.md (bound sandbox only, best effort, never blocks the wake); inspect reports resultFile
- lastAssistantReport skips [tool …] placeholder rows; exhausted turns report 'ran out of steps' (metadata.exhausted on the turn's last row)
- child threads get 400 steps without a skill; budget continuation stays skill-only
fix(wakes): review findings — record the result-file path actually written
All checks were successful
deploy / checks (pull_request) Successful in 39s
deploy / deploy (pull_request) Has been skipped
4a549b6e16
- harness_calls.result_file + conversations.result_file (migration 0052): set at settle by the only writer; inspect and the sweep read it, never derive a path
- saveResultFile returns {path, chars} or a reason (unbound | write-failed); wake says which
- result.chars = the stored (capped) length on both paths
- lastAssistantReport: LIMIT 1000, safe metadata parse
- tests: inspect resultFile present/absent (silent, cancelled, failed write, empty), withResultInstruction
chad merged commit add9f8974f into main 2026-10-17 09:59:52 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
chad/sweatshop-legacy!118
No description provided.