Skip to content

Commit d9194f0

Browse files
os-zhuangclaude
andauthored
docs(agents): the two multi-agent failure modes that cost this branch the most rounds (#4152)
Both written from one branch's lifetime, so every row is something actually hit rather than something that might happen. #9 — refresh a long-lived worktree's build state after merging main. Four stale artefacts each fail AS IF your change broke something, naming other people's exports, other packages' files, or config you never touched: packages/spec/dist check:api-surface reports OTHER people's exports as "N breaking"; check:i18n-coverage rejects an example config for a value the spec allows node_modules a package cannot resolve a dependency it declares runtime/.objectstack/ fixture rows accumulating across runs .cache/objectui-* dozens of lint errors in files never opened None is CI-visible — CI checks out fresh and installs clean — so the whole cost lands on whoever is debugging, which is exactly why it is worth recognising in one step instead of re-diagnosing per gate. Also records that OS_SKIP_DTS=1 leaves no .d.ts, so gen:api-surface cannot run under it at all. #10 — a clean merge is not a working merge. Git conflicts on overlapping lines and says nothing when two changes are individually fine and jointly wrong. Both examples are recent: a test pinning a response body's exact shape landed while that shape was being changed elsewhere (merged clean, failed CI), and a domain file was deleted while another agent's guard still declared it (caught only because the guard existed). Hence pull main and re-run before opening a PR, and again before merging. Claude-Session: https://claude.ai/code/session_01CYbS3kS8xzsHNXFTzp4e2z Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8186a70 commit d9194f0

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
---
3+
4+
Two additions to AGENTS.md's multi-agent discipline. Deliberately empty
5+
frontmatter: documentation, this releases nothing.
6+
7+
**#9 — refresh a long-lived worktree's build state after merging `main`.** Four
8+
distinct stale artefacts each fail *as if your change broke something*, naming
9+
other people's exports, other packages' files, or config you never touched:
10+
`packages/spec/dist` (makes `check:api-surface` report someone else's exports as
11+
breaking, and `check:i18n-coverage` reject a valid example config), `node_modules`
12+
(a package cannot resolve a dependency it plainly declares), `packages/runtime/
13+
.objectstack/` (fixture rows accumulating across runs), and `.cache/objectui-*`
14+
(dozens of lint errors in files you have never opened). None is CI-visible — CI
15+
checks out fresh — so the cost lands entirely on whoever is debugging. Also notes
16+
that `OS_SKIP_DTS=1` leaves no `.d.ts`, which makes `gen:api-surface` impossible
17+
rather than merely slow.
18+
19+
**#10 — a clean merge is not a working merge.** Git conflicts on overlapping
20+
lines; nothing warns when two changes are individually fine and jointly wrong.
21+
Both examples are real and recent: a test pinning a response body's exact shape
22+
landed while that shape was being changed elsewhere, and a domain file was deleted
23+
while another agent's guard still declared it. The first merged clean and failed
24+
CI; the second was caught only because the guard existed. Hence: pull `main` and
25+
re-run before opening a PR, and again before merging.
26+
27+
Written from one branch's lifetime — every row is a failure that cost a debugging
28+
round, so the list is what was actually hit rather than what might happen.

AGENTS.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,37 @@ own worktree, operate defensively:
117117
up your own instance on a random high port (`pnpm dev -- --fresh -p <random>`)
118118
and **shut it down yourself when the task is done**
119119
(`kill $(lsof -ti tcp:<port>)`). Don't leave orphan servers behind.
120+
9. **After pulling `main` into a long-lived worktree, refresh its build state
121+
before you trust a single test or gate.** A worktree that has been open across
122+
several merges accumulates artefacts that are stale relative to the source, and
123+
every one of them fails **as if your change broke something** — naming other
124+
people's exports, other packages' files, or config you never touched:
125+
126+
| stale artefact | how it presents | why it lies |
127+
|---|---|---|
128+
| `packages/spec/dist` | `check:api-surface` reports *other people's* exports as "N breaking (removed/narrowed)"; `check:i18n-coverage` rejects an example config for a value the spec allows | both read the built `.d.ts`, not `src/` |
129+
| `node_modules` | a package fails to resolve a dependency it plainly declares (`Cannot find package 'hono'`) | the merge moved `pnpm-lock.yaml` |
130+
| `packages/runtime/.objectstack/` | `datasource-autoconnect` sees each row 6× | gitignored fixture state accumulating across runs |
131+
| `.cache/objectui-*` | `pnpm lint` reports dozens of errors in files you have never opened | a full objectui checkout left by `build-console.sh`, linted as if it were ours |
132+
133+
So after any `git merge origin/main`:
134+
`pnpm install --frozen-lockfile && pnpm build && rm -rf packages/runtime/.objectstack`
135+
(add `rm -rf .cache` if you have run the console build). Note `OS_SKIP_DTS=1`
136+
keeps a build fast but leaves no `.d.ts`, so `gen:api-surface` cannot run at
137+
all under it — that one needs a real build.
138+
139+
None of this is CI-visible: CI checks out fresh and installs clean. It costs
140+
only *your* time, which is exactly why it is worth recognising in one step
141+
rather than re-diagnosing per gate.
142+
10. **A clean merge is not a working merge.** Git conflicts on overlapping lines;
143+
nothing warns you when two changes are individually fine and jointly wrong.
144+
Real examples from one branch's lifetime: a test asserting a response body's
145+
exact shape landed while that shape was being changed elsewhere (merged clean,
146+
failed CI); a domain file was deleted while another agent's guard still
147+
declared it. **Before opening a PR, and again before merging, pull `main` and
148+
re-run the suite** — the second CI round is where these surface, and the guards
149+
in `scripts/check-*.mjs` exist largely because this class of breakage is
150+
invisible to `git merge`.
120151

121152
---
122153

0 commit comments

Comments
 (0)