Skip to content

chore(harness): reconcile orchestrator plugin to 0.3.0 after machine migration - #173

Merged
robercano-ghbot merged 3 commits into
mainfrom
chore/harness-migration-fixes
Aug 6, 2026
Merged

chore(harness): reconcile orchestrator plugin to 0.3.0 after machine migration#173
robercano-ghbot merged 3 commits into
mainfrom
chore/harness-migration-fixes

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

Reconciles this repo with orchestrator plugin 0.3.0 after the machine migration, and fixes the environment problems the migration exposed.

The plugin install itself was never broken — orchestrator@recode 0.3.0, commit 2adf6d7, enabled, marketplace registered. Everything below was repo state or machine env.

Commits

  1. chore(harness) — plugin reconciliation, worktree bootstrap, hook de-duplication, pnpm 10.x fix
  2. chore(studio) — pure regeneration of contracts.generated.json now that Foundry deps resolve

Highlights

Managed files re-stamped. pr-loop.service v1→v2 (#134 ExecStart resolver), claude-rc.service v5→v6 (#124Type=simple + inline tmux supervisor, so a dead planner no longer hides behind a permanently-active unit).

arm-loop.sh taken at v7, not v6. The plugin disagrees with itself: scripts/arm-loop.sh is v7 while its setup template is v6, and sync.sh stamps from the template. v7 is what pairs with the v7 loop-tick.sh that resolves from the plugin cache (--stop-after-days / loop-arming.json, #95). Fix + regression guard sent upstream as robercano/reCode#223; sync now reports this file as kept (newer).

.claude/scripts/ trimmed 17 → 8. Nothing here was ever custom — it was a stale mirror missing ~25 scripts 0.3.0 ships. Kept only what must be repo-local: gate.sh + resolve-roots.sh (CI runners have no plugin cache, and the plugin's own gates.yml/action.yml templates hardcode this path), prepare-pr.sh (test-pr.md hardcodes it), arm-loop.sh (MANIFEST-managed), worktree.sh, bot-gh.sh, merge-ready.sh, notify-poll.sh. .claude/agents/ deleted — stale pre-#134 copies shadowing the plugin's own.

Worktree bootstrap was silently broken. gates.json had no worktree key, so implementers — which run in isolated worktrees with no node_modules and no contracts/lib — got no bootstrap, and their gates failed for missing deps rather than real defects. worktree.sh had never existed in this repo at all: nothing ever copied it, and post-#134 nothing would have. Filed upstream as robercano/reCode#225.

Every gate was running twice per turn. .claude/settings.json declared PostToolUse/Stop hooks that the plugin also registers via hooks/hooks.json — two concurrent pnpm -r build into the same dist/, surfacing as a racy Stop hook error: No stderr output. Dropped ours; a _hooks note records why they must not come back. Filed upstream as robercano/reCode#224.

test_affected is now loop-only. It is the gate the Stop hook fires, so unguarded it ran the whole monorepo build+test after every assistant turn — including pure planning turns in claude remote-control, which loads these same hooks via WorkingDirectory=<repo>. Detection keys off an env var the loop daemon exports into every claude -p it spawns; REDEPLOY_LOOP=1 forces it. Fail-open is bounded — CI stays the authoritative merge gate, test_affected is not in its matrix, and the skip prints rather than passing silently.

pnpm 10.x. onlyBuiltDependencies moved to pnpm-workspace.yaml; pnpm 10.33 stopped reading the pnpm field in package.json and had been ignoring it, so esbuild's build script was no longer allowlisted.

Fixed outside the repo (context, not in this PR)

  • ~/.foundry/bin was exported below the non-interactive guard in ~/.bashrc, so hooks, subagents and systemd units never saw forge. Moved above the guard.
  • contracts/lib/ had never been fetched on this machine. Ran the install gate.

Gates

All green, verified end to end after the two fixes above:

install ✓   build ✓   lint ✓   typecheck ✓   test ✓   coverage ✓

⚠️ CI may fail on unrelated grounds right now — GitHub's action-resolution service is returning Service Unavailable at the "Prepare all required actions" step, before the workflow is even read. Re-run once it recovers.

🤖 Generated with Claude Code

robercano and others added 2 commits August 6, 2026 18:53
…migration

Migrating this repo to a new machine surfaced a pile of unrelated breakage that
all landed at once. The plugin install itself was fine (orchestrator@recode
0.3.0, commit 2adf6d7, enabled); everything below was repo state or machine env.

Plugin reconciliation (/orchestrator:sync):
- Restamp managed files: pr-loop.service v1->v2 (ExecStart now resolves
  loop-daemon.sh from the plugin cache when no repo-local copy exists, issue
  #134), claude-rc.service v5->v6 (Type=simple + inline tmux supervisor so a
  dead planner no longer hides behind a permanently-"active" unit, issue #124).
- arm-loop.sh taken at v7 from the plugin's scripts/ copy rather than v6 from
  its setup template: the two disagree upstream, and v7 is what pairs with the
  v7 loop-tick.sh that resolves from the plugin cache (--stop-after-days /
  loop-arming.json, issue #95). Fix + regression guard sent upstream as
  robercano/reCode#223; sync now reports this file as "kept (newer)".
- Delete .claude/agents/: stale pre-#134 vendored copies that shadowed the
  plugin's own, which is where agents resolve from now.
- Trim .claude/scripts/ from 17 files to the 8 that must genuinely be
  repo-local, each refreshed byte-identical from plugin 0.3.0. Nothing here was
  ever custom — it was a stale mirror, missing ~25 scripts 0.3.0 ships. Kept:
  gate.sh + resolve-roots.sh (CI runners have no plugin cache and the plugin's
  own gates.yml/action.yml templates hardcode this path), prepare-pr.sh
  (.claude/commands/test-pr.md hardcodes it), arm-loop.sh (MANIFEST-managed),
  worktree.sh (newly required, see below), bot-gh.sh, merge-ready.sh,
  notify-poll.sh. Dropped the loop-* internals: pr-loop.service v2 resolves
  those from the plugin cache by design. Upstream inconsistency filed as
  robercano/reCode#225.

Worktree bootstrap (this was silently broken):
- gates.json gained a "worktree" key. Implementers run in isolated worktrees,
  which have no node_modules and no contracts/lib, and the bootstrap hook was
  unconfigured — so in-worktree gates failed for missing deps and looked like
  real defects. setup now mirrors the install gate. worktree.sh itself had
  never existed in this repo: nothing ever copied it and, post-#134, no
  mechanism would have.

Hooks (every gate was running twice per turn):
- Drop the PostToolUse/Stop hooks from .claude/settings.json. The plugin
  registers both itself via hooks/hooks.json, so both fired — two concurrent
  `pnpm -r build` into the same dist/, surfacing as a racy "Stop hook error:
  No stderr output". Filed upstream as robercano/reCode#224; a _hooks note in
  settings.json records why they must not come back.
- gates.test_affected is now loop-only. It is the gate the Stop hook fires, so
  unguarded it ran the whole monorepo build+test after every assistant turn --
  including pure planning turns in `claude remote-control`, which loads these
  same hooks via WorkingDirectory=<repo>. Detection keys off an env var the
  loop daemon exports into every `claude -p` it spawns. Fail-open is bounded:
  CI remains the authoritative merge gate and test_affected is not in its
  matrix, and the skip prints rather than passing silently.

pnpm 10.x:
- Move onlyBuiltDependencies to pnpm-workspace.yaml. pnpm 10.33 stopped reading
  the "pnpm" field in package.json and had been ignoring it, so esbuild's build
  script was no longer allowlisted.

Not in this commit: ~/.foundry/bin was exported below the non-interactive guard
in ~/.bashrc, so hooks, subagents and systemd units never saw `forge` (fixed on
the machine, outside the repo), and contracts/lib had never been fetched here
(fixed by running the install gate).

Gates: install, build, lint, typecheck, test, coverage all pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Regenerated by the build gate now that contracts/lib is actually populated.
The previously committed manifest was produced in an environment where the
OpenZeppelin libs were not fully resolvable, so inheritance chains were
truncated: AccessControl-derived contracts were missing ERC165/IERC165/Context,
and Ownable-derived ones were missing Context.

Pure regeneration — no hand edits, no source change. Reproduce with:
  bash .claude/scripts/gate.sh install && bash .claude/scripts/gate.sh build

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@robercano-ghbot robercano-ghbot added type:infra Repo-wide tooling/infra (touches root config) claude-ci-fixing PR is being CI-fixed by the autonomous loop labels Aug 6, 2026
gate.sh's node_modules-vs-pnpm-lock.yaml staleness preflight (added for
issue #129) ran unconditionally, including for the 'install' gate
itself. On a fresh checkout there is no node_modules yet, so the
preflight always fired and aborted before 'pnpm install' — the exact
command the abort message points at as the remedy — ever got to run.
Every other gate calls 'install' first via
.github/actions/setup/action.yml, so this single bug cascaded into
every CI job failing with "node_modules is out of sync" on PR #173.

Skip the preflight when key == "install"; every other gate keeps the
check unchanged, since only a gate that's about to actually execute
against node_modules needs it fresh.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

Pushed a fix for the CI failure: .claude/scripts/gate.sh's dependency-freshness preflight was aborting the install gate itself on a fresh checkout (no node_modules yet), before pnpm install could ever run — cascading into every job. Exempted the install gate from that preflight. Verified locally from a genuinely fresh, node_modules-less checkout: install/build/lint/typecheck/test/coverage all green.

@robercano-ghbot robercano-ghbot added the needs-human Loop escalated: manual triage required label Aug 6, 2026
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

chore(harness): reconcile orchestrator plugin to 0.3.0 after machine migration (not yet reviewed)

@robercano-ghbot robercano-ghbot removed the needs-human Loop escalated: manual triage required label Aug 6, 2026
@robercano-ghbot
robercano-ghbot merged commit 8861e2c into main Aug 6, 2026
0 of 6 checks passed
@robercano-ghbot
robercano-ghbot deleted the chore/harness-migration-fixes branch August 6, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-ci-fixing PR is being CI-fixed by the autonomous loop type:infra Repo-wide tooling/infra (touches root config)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants