Skip to content

feat(t27os): DOCTOR watches agent litter, in-use folders and low disk; CLAUDE.md where t27 work lives - #12188

Merged
gHashTag merged 2 commits into
masterfrom
claude/doctor-litter-watches
Oct 25, 2026
Merged

gHashTag merged 2 commits into
masterfrom
claude/doctor-litter-watches

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

What this adds

The T27 OS DOCTOR now watches the problems found in the 2026-10-25 disk cleanup (2.8 GiB free, the app refused to make a worktree, about 38 GiB of agent litter removed by hand).

  • Agent litter roots. ~/t27-lanes/, ~/t27-lane-*, ~/t27-wt-*, /private/tmp/, /tmp/, .claude/worktrees/, .codex/ and .gemini/ classify a repo as agent litter.
  • In-use guard. A leftover is removable only after an lsof check found no process with a working directory or open file below it. The check runs only for leftovers (job_wanted), is repeated synchronously at confirm time, and fails closed: not checked, or an answer above exit code 1, means not removable. New flags F_IN_USE and F_IN_USE_CHECKED; new keep reason "keep: a process is using it".
  • Low disk and what could be freed. Under 6 GiB free the panel says "low disk" and shows the total of removable rows ("N GB to free").
  • One home for the rules. CLAUDE.md section "Where t27 work lives" holds them; AGENTS.md points at it.

Decisions live in specs/t27os/doctor.t27 as pure functions with tests; specs/t27os/glass_window.t27 only does plumbing (the sixth repo job, two flags, one panel line).

Checks run

  • t27c test-report specs/t27os/doctor.t27 on the rebased branch: 13 tests, 13 pass, 0 fail, 0 vacuous (new: a_folder_a_process_is_using_is_never_offered, the_panel_counts_only_what_can_go, the_disk_floor_is_the_apps_floor, the_in_use_check_runs_only_for_leftovers).
  • t27b build specs/t27os/glass_window.t27 --macho on the rebased branch: compiles, no error line (the existing t27b: AAPCS64 for aggregates and stack parameters, so those functions are exported too #8972 notes only).
  • First compile caught a name clash (F_LIVE already comes from t27os::release), so the flags are named F_IN_USE and F_IN_USE_CHECKED.

Not done / trade-offs

Closes #12183
Refs #12184

🤖 Generated with Claude Code

…; CLAUDE.md "Where t27 work lives"

Found in the 2026-10-25 disk cleanup (2.8 GiB free, the app refused to make a worktree): agent
clones and worktrees piled up in the home folder and /tmp.

- doctor.t27: agent roots (~/t27-lanes, ~/t27-lane-*, ~/t27-wt-*, /private/tmp, /tmp, .codex,
  .gemini), an in-use guard (lsof, fails closed, leftovers only, F_IN_USE / F_IN_USE_CHECKED),
  a low-disk word under 6 GiB and a "to free" total; 13 tests, 0 vacuous.
- glass_window.t27: plumbing only (the sixth repo job, the flags, the panel line); compiles
  with t27b --macho, no error.
- CLAUDE.md: one section holds the rules where t27 work lives; the other homes point at it.

Non-repo scratch trees and loose lane files are the follow-up #12184.

Closes #12183
Refs #12184

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gHashTag gHashTag added the no-auto-merge Opt out of the issue gate's default squash auto-merge (issue-gate.yml) label Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-25 03:14:16 UTC

Summary

Status Count
Total Open PRs 47
PRs with Failing Checks 43
PRs with All Checks Green 4
READY 3
FAILING 43
PENDING 0
NO CHECKS YET 0

These columns do not partition: 3 + 43 + 0 + 0 = 46, and there are 47 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=55c0f1b1b32d != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag

Copy link
Copy Markdown
Collaborator Author

Night tick 155, lab gate on head fd10d9a: T27 OS lab run https://github.com/Trinity-S-AI-DNA/t27os/actions/runs/40157835044 (challenge 9fe77612).

specs/t27os/doctor.t27|tests=13|pass=13|FAIL=0|vacuous=0|blocked=0           (t27c test-report)
specs/t27os/doctor.t27|leg=t27b|tests=13|pass=13|FAIL=0|vacuous=0|asserts=121 (t27b, arm64)
gate: every named spec passed (FAIL=0, blocked=0)

specs/t27os/glass_window.t27 was left out on purpose: it is an @extern host spec, so the lab's t27c leg reports it blocked=1 and the gate goes red (run 40153266799). This PR's CI t27b legs verify it.
No runs/fd10d9a3...json file appeared in Trinity-S-AI-DNA/t27os after the run (same as the other branch-ref dispatches), so the run log above is the receipt.

@tri-claw

tri-claw Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary by t27-bees

Checked by the t27 compiler

t27c parse, parse-complete and typecheck on each changed .t27 file at 79e814f. Nothing was generated, built or run. A pass means the file is well formed, not that it is right.

  • specs/t27os/doctor.t27: parses and typechecks.

Read by the model

The PR teaches the T27 OS DOCTOR to recognize agent litter roots (new AGENT_ROOTS patterns), guard against removing folders a process has open (new JOB_LIVE/lsof check, fails closed), and surface a "low disk" warning with a "to free" total when free space drops below 6 GiB. The rules are centralized in CLAUDE.md.

Worth a look

  • specs/t27os/doctor.t27:61–63 — The lsof command line (-c ^git -c ^du +D {p}) relies on lsof 4.91’s prefix-exclusion semantics; the comment notes the exact -c ^/re/ form is ignored. If the host runs a different lsof version, the exclusions may not work, causing the DOCTOR’s own git/du processes to be counted as “in use” and blocking removal of clean folders.

  • specs/t27os/doctor.t27:61–63 / specs/t27os/glass_window.t27:9614–9625 — lsof exits 1 whether or not it finds pids; stderr is joined to stdout for JOB_LIVE. Any error output (permission denied, command not found, path gone) becomes non-empty stdout → treated as “in use” (fails closed). A missing /usr/sbin/lsof or a transient error will falsely keep a folder.

  • specs/t27os/glass_window.t27:9808–9830 — dk_trash re-runs all three checks (status, unpushed, in-use) synchronously at confirm time. On a large leftover tree the lsof +D walk can block the UI for seconds; the PR acknowledges this as deliberate but it is a visible freeze.

  • specs/t27os/doctor.t27:43–48 — AGENT_ROOTS adds /t27-lane- and /t27-wt- as substring matches inside the slashed path. The comment claims “/t27-wt- catches ~/t27-wt-croncard … but not ~/projects/my-t27-wt-notes”, which only holds if the host matches on path components, not raw substrings. The matching logic lives in the host (not shown); if it does a simple contains, it will over-match.

  • specs/t27os/glass_window.t27:9298–9310 — The panel reads free space from sst[SST_DISK] (free GiB + 1, 0 = unknown). If the host never writes that slot, dfree stays DISK_UNKNOWN and the “low disk” warning never appears, even when the disk is full.


Read: 4 files, +214 -31, the whole diff. Head 79e814f. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

@gHashTag

Copy link
Copy Markdown
Collaborator Author

Lab receipt (correction: an earlier tick said no receipt; the night loop's local t27os checkout was on a feature branch, and the receipt is on t27os master): https://github.com/Trinity-S-AI-DNA/t27os/blob/master/runs/fd10d9a39241ad43190077f86727fca9e7a07a70.f4459697.json

specs/t27os/doctor.t27|tests=13|pass=13|FAIL=0|vacuous=0|blocked=0
specs/t27os/doctor.t27|leg=t27b|tests=13|pass=13|FAIL=0|vacuous=0|asserts=121

reader: T27 OS lab t27c built at fd10d9a + t27b leg (arm64), spec specs/t27os/doctor.t27
judge: t27c test-report and t27b test; known failure modes: vacuous pass, blocked spec (t27os#13)
n: one run (40157835044)
cost: 4 min 38 s wall-clock, one runner
repro: gh workflow run lab.yml --repo Trinity-S-AI-DNA/t27os -f sha=fd10d9a39241ad43190077f86727fca9e7a07a70 -f challenge=9fe77612 -f specs=specs/t27os/doctor.t27

…ts state the prefix match and the anchored roots (Refs #12183)

Review of #12188 (tri-claw): lsof exits 1 whether it printed a pid or failed, so an
error with empty stdout read as "idle". The host now joins stderr to stdout for
JOB_LIVE only: a failed lsof prints text, which counts as "in use". A normal run
prints nothing on stderr (measured: 0 bytes), so no row is kept by noise.

Also measured on lsof 4.91: the exact-name exclusion "-c ^/re/" is ignored, so
"-c ^git -c ^du" stays a prefix match; the JOB_LIVE and AGENT_ROOTS comments now
say so, and that every root begins with "/" (a folder name must start with it).

doctor.t27 13/13 tests, 0 vacuous; glass_window.t27 compiles with t27b --macho.

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

Copy link
Copy Markdown
Collaborator Author

Addressed in 79e814f (review of fd10d9a):

  • lsof exit 1 vs idle (fixed). The host now joins stderr to stdout for the in-use job only, so a failed lsof prints text and reads as "in use" (fails closed). A normal run prints 0 bytes on stderr (measured here), so no row is kept by noise.
  • -c ^git -c ^du is a prefix match (kept, now stated). I tried the exact-name form -c ^/^git$/: lsof 4.91 ignores it (exclusion count unchanged), so there is no exact exclusion. A process named git* or du* is not counted; shells, editors, node, cargo and the agents are. The JOB_LIVE comment says so.
  • AGENT_ROOTS substring match (kept, comment sharpened). Every root begins with /, so it must open a folder name: ~/projects/my-t27-wt-notes does not match, ~/t27-wt-croncard does. A hit only labels the row "agent copy"; the removal gates (clean, pushed, no stash, idle, two clicks, Trash) still apply.
  • F_ALL_CHECKED bit layout. Already pinned by the_in_use_check_runs_only_for_leftovers; no change.
  • Synchronous re-check at confirm. Deliberate: the answer must be fresh at the second click; it runs for one folder only.

doctor.t27: 13/13 tests, 0 vacuous. glass_window.t27 compiles with t27b build --macho.

🤖 Addressed by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-25 04:04:58 UTC

Summary

Status Count
Total Open PRs 48
PRs with Failing Checks 41
PRs with All Checks Green 7
READY 3
FAILING 41
PENDING 0
NO CHECKS YET 0

These columns do not partition: 3 + 41 + 0 + 0 = 44, and there are 48 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=55c0f1b1b32d != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag

Copy link
Copy Markdown
Collaborator Author

Night tick 158: lab dispatched on head 79e814f (run 40160647760, challenge 4dbef9db, specs/t27os/doctor.t27; glass_window.t27 left out, @extern).
Receipt lands at Trinity-S-AI-DNA/t27os runs/79e814f2fe8609a0cd40e2c7bf71bff1065b45fc.*.json

@gHashTag

Copy link
Copy Markdown
Collaborator Author

Lab receipt for head 79e814f (night tick 159): Trinity-S-AI-DNA/t27os runs/79e814f2fe8609a0cd40e2c7bf71bff1065b45fc.7a07187c.json (run 40160647760, success).

  • t27c: specs/t27os/doctor.t27|tests=13|pass=13|FAIL=0|vacuous=0|blocked=0
  • t27b: specs/t27os/doctor.t27|leg=t27b|tests=13|pass=13|FAIL=0|vacuous=0|asserts=121

glass_window.t27 is an @extern host file and is not in the t27c leg.

This was referenced Oct 25, 2026
@gHashTag
gHashTag merged commit 48c4d97 into master Oct 25, 2026
36 checks passed
@gHashTag
gHashTag deleted the claude/doctor-litter-watches branch October 26, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-auto-merge Opt out of the issue gate's default squash auto-merge (issue-gate.yml)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T27 OS DOCTOR: watch agent litter, in-use folders and low disk (found in the 2026-10-25 disk cleanup)

1 participant