Skip to content

Keep background git maintenance and local object copies out of the clone test fixtures - #245

Merged
yansfil merged 3 commits into
mainfrom
fix/clone-test-no-local
Sep 28, 2026
Merged

yansfil merged 3 commits into
mainfrom
fix/clone-test-no-local

Conversation

@yansfil

@yansfil yansfil commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Related: 2a8e6d1 is on feat/overview-lenses (#238); the maintenance guard was found while working on #242. This lands both on main.

Summary

Review

Evidence

AI tooling: mostly AI tools; the diff is three cherry-picked commits, compared by hand.

A local bare clone hard-links or copies each object file, and on a CI runner
two tests failed there with "failed to copy file ... No such file or
directory" before the code under test ran. --no-local sends the objects as a
pack instead.
git commit starts a detached git maintenance run --auto, which can pack
and prune the fixture's loose objects while the next git clone --bare is
still copying them, failing a random clone test with "failed to copy file
to ...: No such file or directory" on the hosted macOS runner. The
fixture's git calls now turn auto maintenance and auto gc off.
The core's clone tests build their bare repository the same way, commit
then a local git clone --bare, so they carry the same race. Both comments
now say which setting carries the fix.
@yansfil yansfil changed the title Build the clone tests' bare origin through Git's transport Keep background git maintenance and local object copies out of the clone test fixtures Sep 28, 2026
@yansfil
yansfil merged commit d591a0a into main Sep 28, 2026
11 of 13 checks passed
@yansfil
yansfil deleted the fix/clone-test-no-local branch September 28, 2026 11:50
yansfil added a commit that referenced this pull request Sep 28, 2026
…d agent again (#243)

Related: #236, #237

## Summary

Closes #236. Closes #237.

- **#236:** Herdr can report the agent hcoord started with no name, and
the lineage step then refused it (`identity_conflict`) although the
agent was running.
  - This happens after a confirmed start.
- It also happens after an unconfirmed one: a prompt passed as a native
argument keeps Claude Code working past readiness, `agent start` times
out, and the pane's agent is unnamed.
- Right after its own start, confirmed or not, hcoord records the pane's
terminal and any session Herdr reports within 2 s as the started
execution.
- In that same call it renames an unnamed agent (`herdr agent rename`)
when pane, kind and terminal (and any recorded session) match.
- A later same-intent retry renames only when a recorded session exists
and matches, because a pane keeps its terminal while agents are
restarted in it.
- `--resume-start` clears the recorded start of an agent that is gone
before it launches a new one.
- **#237:** name, kind and native arguments are checked before hcoord
registers a `--parent here` pane, writes a letter, or reserves an
intent.
- A refused spawn creates no worktree, workspace or pane, and the daemon
repeats the check at reserve.
- An executable name followed by flags after `--` (such as `-- claude
--dangerously-skip-permissions` under the default `codex` kind) is
refused, and the error names the `--kind` to pass.
- `hcoord agent spawn --help` prints the spawn usage, including `--kind`
and how `claude` and `codex` arguments are passed.
- The README spawn example is corrected.

No screen changes.

```
before  $ hcoord agent spawn --parent here --name kid1 ... -- claude --dangerously-skip-permissions
        hcoord: invalid_argument: Codex task must be the final native argument   (worktree + workspace left behind)
after   hcoord: invalid_argument: arguments after -- go to the codex executable itself, so drop the leading "claude"
        and pass --kind claude to start claude; see hcoord agent spawn --help          (nothing created)
```

## Review

- **Please judge:** automatic renaming uses the terminal only in the
call that started the agent; a retry needs a matching recorded session.
So a `codex` start that timed out (no session yet) still needs a manual
`herdr agent rename` on retry after a person checks the pane.
An unnamed agent in another terminal or session is refused as a
replacement and never renamed.
- **Please judge:** #237's "same-intent retry reuses or cleans up" is
covered by refusing first, since argument errors no longer leave
anything partial.
A retry with *different* arguments on the same intent remains
`intent_conflict`.
- **Please judge:** a lone word after `--` (for example the prompt
`claude`) is accepted as a prompt or task.
  So `-- codex` under the `codex` kind still sends `codex` as the task.
- **Files to review carefully:**
- `plugins/hcoord/src/hcoord/transport.ts` (spawn sequence): the failure
path.
An unconfirmed start now continues like a retry would, and only
`agent_pane_busy` stops it.
- `plugins/hcoord/src/hcoord/herdr.ts` (`observeStartedAgent`,
`nameSpawnedAgent`, `inspectSpawnedAgent`): identity binding over the
Herdr contract (`agent.rename` is in the pinned schema).
- `plugins/hcoord/src/hcoord/service.ts` (`agent.spawn.started`,
`agent.spawn.start_reset`): new ledger steps.
    The spawn event budget goes from 7 to 8 slots.
`started` refuses a terminal or session that differs from the first
observation, and `start_reset` clears it on `--resume-start`.
- **Follow-up:** `observeStartedAgent` records nothing when `agent get`
does not answer within 2 s, or when the daemon dies before the ledger
write.
  Such an intent behaves like one saved before this change.
- **Known effect:** saved native arguments are re-validated on
`--resume-start` and at reserve.
An intent reserved before this change with an executable name followed
by flags now fails on rerun, even after its pane exists.

## Evidence

- **Cause of #236:** a separate batch run on 2026-09-28 found it on this
machine, with herdr 0.9.1.
- `herdr agent start ... -- --dangerously-skip-permissions --effort high
"<prompt>"` timed out (`{"code":"timeout"}`) because Claude Code went
straight to work.
- Afterwards, looking the agent up by its name returned
`agent_not_found` until `herdr agent rename` was run.
- Starting without the prompt argument and sending the prompt later kept
the name, on 4 spawns.
- **Confirmed live, #236 (isolated Herdr 0.9.1 server, private HOME and
`HCOORD_HOME`, real Claude Code, this branch):**
- A wrapper reports a successful start as Herdr's `timeout` (exit 1) and
clears the name.
With it, the spawn exits 0, logs `hcoord.spawn_name_restored`, writes
lineage `written`, and `agent get` shows the name and `parent_pane`.
- A wrapper that only clears the name after a confirmed start gives the
same result.
    On `main`, that case fails with the issue's `identity_conflict`.
- Two real inline-prompt spawns were confirmed by Herdr before the
prompt ran.
    I could not make a real start time out on demand.
- **Confirmed live, #237:** refused spawns (an executable name plus
flags under `codex`, and a misplaced `codex` task) exit 2.
Worktrees, workspaces, intents, participants, the outbox and branches
are all unchanged; on `main` the same command left a worktree and a
workspace behind.
- **Confirmed (hcoord suites):** typecheck, build, unit 30/30, e2e 26/26
(fake Herdr). New e2e cases:
- Starts ending in `timeout` or `agent_not_ready` name and register the
agent.
- A retry with no recorded session (same terminal) refuses with the
manual rename and does not rename; after a manual rename it binds.
- With a session recorded at start, a refused rename ends as
`spawn_uncertain` / `name_agent`, and a retry renames and binds.
  - An unnamed agent in a replaced terminal is refused and not renamed.
- After the first agent exits, `--resume-start` binds the new session;
without the reset this case fails.
  - A refusal with `--repo --branch` never calls `worktree create`.
- `--parent here` validates before inspecting the pane, and `--help`
prints the spawn usage.
- **Confirmed (other checks):** repository structural checks and
`check-no-attribution.py`.
- **CI:** the `clone.rs` fixture flake is fixed on `main` by #245, which
is merged into this branch.
The last run failed `desktop/e2e/add-project.spec.ts:134` in its cleanup
(`rmdir` ENOTEMPTY), outside this diff.
- **Not confirmed:**
- A real Herdr start timing out on demand (simulated instead, as above).
  - Web, desktop and Rust lanes, which this diff does not touch.
  - No screenshot, because nothing on screen changed.

**AI tooling**: mostly AI tools; the live runs above were checked by
reading Herdr's `agent get` output, the hcoord ledger events and `git
worktree list` directly.
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.

1 participant