Skip to content

I1995 — Work a session left uncommitted in a worktree is named, not found by luck

Make doctor and the worktree status name a linked worktree whose index or working tree holds changes no commit carries and no live session holds, with how many files and how old, so that finished work on one disk is seen before the disk is.

DONE wave 0 · p1 · implementation profile · parallel safe

Part of development-runtime — The runtime has a development surface.

Objective

Make doctor and the worktree status name a linked worktree whose index or working tree holds changes no commit carries and no live session holds, with how many files and how old, so that finished work on one disk is seen before the disk is.

Why

Twice in two days finished work existed on one disk only. On 2026-10-07 the supersession-trust half of the integration safety fixes sat as 45 uncommitted files in the worktree of a session that had ended; it was pushed as origin/rescue/integration-supersession-trust-20261007 and became #808 and #809. On 2026-10-08 the completion doctrine sat as 21 staged files in another ended session's worktree; it was pushed as origin/rescue/completion-doctrine-20261008. Neither had a commit or a remote ref, and the same evening the data volume reached 125 MiB free. `majordomus doctor` names branches whose commits reach no remote. It says nothing about an index that holds work no commit carries, so both were found only because someone happened to read that worktree.

Current state

doctor reports unpushed branches. `majordomus worktree` reports a worktree as dirty without saying how much, for how long, or whether any session is working in it. Nothing reports the set of worktrees holding uncommitted work that nobody is attached to.

Desired state

One reading lists every linked worktree with staged or unstaged changes: the count of paths, the age of the oldest change, and whether a session or task is active there. doctor warns for each one that is older than a declared age with no active session. The reading changes nothing and suggests the command that preserves the work on a remote ref.

Scope

  • apps/majordomus-cli/src/capability/builtin/worktree.rs
  • lib/doctor.sh
  • docs/WORKTREES.md
  • test/cases

Dependencies

None. This issue is a root of the graph.

Acceptance criteria

  • A worktree with staged files and no active session is named by doctor with its path, the number of paths and the age of the oldest
  • A worktree with uncommitted work and an active task or attached session is listed and not warned about
  • The reading writes nothing: `git status` of every worktree is the same before and after it

Validation

  • bin/majordomus plan validate
  • MJ_TEST_JOBS=4 bash test/run.sh <the case this issue adds>

Evidence required

  • abandoned_index_named_case
  • reading_is_read_only_case

Evidence

coverstypecommandresultat commit
abandoned_index_named_casetestMJ_TEST_JOBS=3 bash test/run.sh 3025_abandoned_work_in_a_worktree_is_named 02_doctor_basic 599_a_silent_check_is_not_a_pass 96_worktree_topologytests: 4 passed, 0 failed; case 3025 builds four linked worktrees: one with 3 staged paths aged to 2020 and a stranded episode is named by doctor with its path, count, age and the rescue command; one held by an active task and one by a live episode are listed and not warned; the commit hook's context prints that it does not read and never calls the reading (run 2026-10-14 17:2xZ on master ff3829709616e638596315d6ca42be64b570b74f plus this change)ff38297
reading_is_read_only_casetestMJ_TEST_JOBS=3 bash test/run.sh 3025_abandoned_work_in_a_worktree_is_named 02_doctor_basic 599_a_silent_check_is_not_a_pass 96_worktree_topologycase 3025 compares git --no-optional-locks status --porcelain and each index's bytes and mtime of all five worktrees before and after the CLI reading, the MCP call and doctor: identical. Against this machine's real repository: 301 worktrees identical before and after, 91 with uncommitted work, 54 abandonedff38297

Timeline

started
2026-10-14T17:16:55Z
verified
—
completed
2026-10-14T17:17:04Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I1995.yaml. Read it back with majordomus plan show I1995.

Searches the titles and descriptions of every page this site publishes.