QM-31: Bootstrap the factory source clone separately from the work repo - #1036
Conversation
Semantic disposition audit at
|
Auth failures, a missing branch, and a missing repository all exit 128. The error now carries the last lines of git's output with the token masked, so an operator can tell them apart from the run's failure reason.
Closes QM-31.
Changes
Why this matters: The factory loop started its coding-agent wrapper from the subject
repository it was about to work on, and pointed the wrapper's factory-source directory at
that same place. The wrapper, its workflows and its factory tools live in a different
repository, and nothing ever put them in the sandbox, so a work run launched a script that
was not there. The failure was silent: the run degraded to a "no pull request" verdict,
burned an attempt, and gave the operator no signal about the real cause.
What changes:
a shallow clone of
yc-software/qm-ycat a pinned branch into/workspace/qm-yc. Asandbox that already holds that checkout fetches and re-checks-out the pinned branch
rather than re-cloning, so a warm sandbox converges instead of running a stale copy.
stays the subject repo, so the wrapper still clones
IO_REPO_CLONE_URLand runsIO_REPO_SETUP_CMDexactly where it did before.IO_FACTORY_SOURCE_DIRnow names the control-plane checkout andIO_REPO_DIRthe subjectrepo — two distinct directories, as the wrapper's contract requires. Every other variable
in the wrapper's environment is unchanged.
factory_source_bootstrap_failedand never starts the wrapper. The GitHub tokenauthenticates the clone through the process environment only, so it appears in no command
string and in no checked-out git remote.
Acceptance stories:
that did not exist; now the control plane is cloned into the sandbox first and the wrapper
runs from it.
fetched and moved onto the pinned branch, so it never re-clones and never runs the control
plane it first happened to fetch.
different values, so its control-plane snapshot step finds the files it copies instead of
aborting.
factory_source_bootstrap_failed,where before the item quietly burned an attempt and reported "no pull request".
environment, so no logged command string and no persisted git remote carries it.
Test Plan
npm run typechecknpm run lintnode --test test/loop-factory-process-work.test.ts test/loop-factory-effects.test.ts test/loop-factory-wiring.test.tsnpm run test:all— the three remaining failures reproduce identically on a cleanorigin/mainworktree and are unrelated to this change.standing in for the control-plane repository — cold clone, warm fetch and checkout, a
flipped branch pin, and a missing branch all behaved as intended.
Proof it works
Proven at runtime: the pre-fix code was first reproduced failing, then the fixed code was
driven against a real git remote and a faithful wrapper stub, covering all five acceptance
stories plus adversarial probes. Captured output is archived with the run, not in the diff:
.io-agent-qm-31/screenshots/.io-agent-qm-31/screenshots/.io-agent-qm-31/screenshots/Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.