Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ When retrieving public web content with `curl`, `wget`, Python HTTP clients, or
- It is acceptable to push and merge code that has been validated with targeted tests without running every single test upfront.
- Run long test suites or CI in the background while progressing on other work in parallel. If background jobs or CI fail, double back and address failures while continuing forward.
- **CI-first verification:** Review the checks actually triggered on the PR and use [`.github/ci-policy.md`](.github/ci-policy.md) to distinguish the basic merge-gating PR tier from the full main tier; formatting is not a merge gate. Run targeted local checks on the laptop when useful; sandboxed workers use CI and must not run builds or tests in the sandbox. If a policy-listed check is missing from the PR, inspect the workflow trigger and report the coverage gap instead of assuming it ran.
- **Build discipline on the laptop (2026-11-10):** Heavy builds/tests (cargo, nix) on the laptop go through `~/tools/fleet-build-lock` (max 2 heavy builds fleet-wide; it also defaults CARGO_BUILD_JOBS to half the cores). Never set `RUSTC_WRAPPER=` empty — that bypasses the shared sccache cache every other lane benefits from. `fleet-build-lock` defaults CARGO_TARGET_DIR to a shared per-package dir (`~/build-cache/<pkg>`, e.g. `~/build-cache/id` for pkgs/id) for cargo builds, instead of a per-worktree target dir: lanes then reuse each other's dependency builds instead of each paying a full ~17-minute compile (measured 2026-11-10: a second source tree on a shared target dir verified in 1s; re-measured 2026-11-11 through the lock, pkgs/atlas-search: 35s isolated target dir -> 1s shared). Set CARGO_TARGET_DIR yourself only to override that default. For Rust verification, run the narrowest build that proves the change: `cargo check` for type-only changes; `cargo test --lib` without `--features web` when the change does not touch web code; named test filters always. The full `--features web` test build of a package like `pkgs/id` costs many minutes of fleet-wide compile and must be justified by the change actually touching that surface.
- **Build discipline on the laptop (2026-11-10):** Heavy builds/tests (cargo, nix) on the laptop go through `~/tools/fleet-build-lock` (max 2 heavy builds fleet-wide; it also defaults CARGO_BUILD_JOBS to half the cores). Never set `RUSTC_WRAPPER=` empty — that bypasses the shared sccache cache every other lane benefits from. `fleet-build-lock` leases CARGO_TARGET_DIR from the cargo target broker (`~/tools/cargo-target-broker`, code#6797) for cargo builds — a bounded pool of warm per-workspace dirs under `~/build-cache/broker-pool`, held under an exclusive lease for the build and returned warm — instead of a per-worktree target dir: lanes then reuse each other's dependency builds instead of each paying a full ~17-minute compile (measured 2026-11-11 through the broker: a pkgs/id test build from a second worktree compiled 1 of 535 units, and a build returning to its own leased dir compiles none; re-measured 2026-11-11 through the lock, pkgs/atlas-search: 35s isolated target dir -> 1s shared). If the broker cannot lease a dir, the lock falls back to the pre-broker static per-package dir (`~/build-cache/<pkg>`, e.g. `~/build-cache/id` for pkgs/id). Sessions launched outside the lock run cargo through `~/tools/cargo-target-broker exec --repo <repo> --profile <test|dev|release> -- cargo ...` to land on the same leased dirs. Set CARGO_TARGET_DIR yourself only to override all of that. For Rust verification, run the narrowest build that proves the change: `cargo check` for type-only changes; `cargo test --lib` without `--features web` when the change does not touch web code; named test filters always. The full `--features web` test build of a package like `pkgs/id` costs many minutes of fleet-wide compile and must be justified by the change actually touching that surface.
- Document unresolved ambiguities, design concerns, or known gaps by creating GitHub issues instead of blocking progress.

## Testing doctrine
Expand Down
28 changes: 19 additions & 9 deletions infra/cargo-target-broker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,22 @@ instead of failing when the per-key cap is fully leased),

## Integration status

Lanes can use `exec` today. The named follow-up wiring point is
`~/tools/fleet-build-lock`: its `CARGO_TARGET_DIR` default block
(code#8392) currently points every same-workspace build at ONE
static dir under `~/build-cache/<key>` — builds that collide there
serialize on cargo's own lock and still alternate fingerprints.
Routing that default through `target-broker checkout/checkin`
gives those lanes pooled, leased dirs instead. That change is a
follow-up, not part of the broker landing; the broker was verified
standalone and against the measurement builds on code#6797.
Fully wired (2026-11-11, code#6797):

- `~/tools/fleet-build-lock` routes its `CARGO_TARGET_DIR` default
through `checkout`/`checkin`: a cargo build that reaches the lock
without `CARGO_TARGET_DIR` set leases a pooled dir — keyed by the
lock's workspace key plus the invocation's profile label — for
the build's duration. If the broker cannot lease, the lock falls
back to the pre-broker static per-workspace dir.
- Repo-queue session launches: the opencode claimant's session
prompts (`pm-stack/opencode-claimant/launch_one.py` and
`claimant.py`) instruct launched sessions to run heavy cargo
builds through `target-broker exec`, and the repo `AGENTS.md`
build-discipline paragraph describes both routes.

Known remaining bypasses: launch surfaces whose stored prompts
predate the claimant change (e.g. OpenChamber's own saved
scheduled-task prompts) inherit only the repo `AGENTS.md`
discipline, and ad-hoc interactive cargo runs are unrouted by
definition.
1 change: 1 addition & 0 deletions pm-stack/opencode-claimant/claimant.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ def launch_step(mode: str, cap_room: int) -> List[Dict]:
Packet: {json.dumps(_prompt_safe_packet(packet), indent=2)}

You are a build agent working on this opencode-lane task.
Build discipline: run heavy cargo builds/tests through ~/tools/cargo-target-broker exec --repo <repo short name> --profile <test|dev|release> -- cargo ... so they use a leased pooled target dir (code#6797); never use a per-worktree CARGO_TARGET_DIR and never blank RUSTC_WRAPPER. ~/tools/fleet-build-lock is an accepted equivalent wrapper.
Use --worker {worker_id} for all queue CLI operations.
Heartbeat while working to keep the claim lease alive.
Finish with a queue terminal verb (complete, park, block, or fail) carrying --worker {worker_id} and --execution '{{"lane": "opencode", "session_id": "{session_id}"}}'.
Expand Down
1 change: 1 addition & 0 deletions pm-stack/opencode-claimant/launch_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def build_prompt(row, ref, repo, directory, sid, worker_id, sender_notes=None):
- Revalidate fresh state (GitHub issue/PR, current main, queue task) before acting; the recorded progress below may be stale.
- Respect hard stops: if the issue/PR carries `held`, `user/owned`, `do-not-merge`, or `do-not-auto-edit`, do not edit it; park or block with the reason.
- Follow {repo}'s AGENTS.md. For code changes use a dedicated worktree; never modify the primary clone's working tree. Preserve unrelated dirty/untracked files.
- Build discipline on the laptop: run every heavy cargo build/test through the cargo target broker, so the build uses a leased, pooled target dir instead of a per-worktree one (code#6797): `~/tools/cargo-target-broker exec --repo <short repo name, e.g. code> --profile <test for cargo test/bench, release for --release builds, else dev> -- cargo ...`. Never set CARGO_TARGET_DIR to a per-worktree dir, and never blank RUSTC_WRAPPER (that bypasses the shared sccache every other lane benefits from). `~/tools/fleet-build-lock <command>` is an accepted equivalent wrapper for cargo (it leases from the same broker) and is the wrapper for nix builds.
- Never put a credential value in a prompt, log, PR, issue, or task record.
- The task is already claimed and lane-bound to this session. It must not be claimed again.

Expand Down
Loading