Repository navigation
Support codex and gemini CLIs as architects (PIR #929) - #1
mohidmakhdoomi wants to merge 1297 commits into
Conversation
…eload; pin out-of-range marker channel to console.warn iter-5 Codex (REQUEST_CHANGES): - Stale activeLine: activeLine persisted across watch/refreshKey reloads without validation, so the overlay could render + on — and emit onAddComment for — a line the reloaded document no longer contained. Fixed at root: reset activeLine on every content change. Regression test: after a reload that removes the hovered block, no + shows and onAddComment never fires for the removed line. - Out-of-range marker channel: plan wording was ambiguous (onError?/console.warn). Tightened to console.warn-only; onError? is reserved for genuine adapter failures (an out-of-range marker is data-hygiene, not a failure). Architect-authorized plan-wording tightening (same basis as the iter-4 D6 spec tightening).
…tiveLine fix; out-of-range channel tightening)
…ples dev page, README - src/__tests__/fixtures/: stub adapters (createStubHost + named stub*Adapter factories over a shared text store; text-as-source-of-truth, cluesmith#857) + a realistic sample artifact with a seeded REVIEW marker. - src/__tests__/end-to-end.test.tsx: the primary contract proof — render → existing marker → hover/click + AND focus/Enter → onAddComment (0-based) → host add serializes INTO text → watch replays → list re-derives → new marker renders. Asserts the marker lands in the text store (round-trip THROUGH text, not a UI-only refresh). - examples/: Vite dev page reusing the same stubs (pnpm dev:example); excluded from the package. - README.md: 3 adapter contracts, ArtifactCanvasProps, --codev-canvas-* tokens + override, host walkthrough, why-tsup rationale, scope. build 0, 33/33 tests, check-types 0, examples bundles headlessly, dist clean (no test/example leak).
…e:* (not npm-published in v1) iter-1 Codex (HIGH): README told consumers to 'pnpm add @cluesmith/codev-artifact-canvas', but v1 is not independently npm-published (per spec-945 / release/protocol.md) — it's consumed via workspace:* and bundled by hosts. Rewrote the Install section to add it as a host workspace dependency; removed all npm-install guidance. Docs-only.
…summary, lessons, arch/lessons updates)
… the review record
…ting read
Per architect review at the pr gate: resolveVersionTimeout + MIN/MAX constants
were over-built for a constant bump. VSCode already returns the package.json
default for an unset setting and enforces minimum/maximum in its settings UI,
so the helper's unset-fallback branch was dead at runtime and only the marginal
clamp/non-number guard ran live.
- Read the setting with the codebase idiom:
getConfiguration('codev').get<number>(KEY, DEFAULT_VERSION_TIMEOUT_MS),
matching overviewRefreshSeconds et al.
- Delete resolveVersionTimeout, MIN_VERSION_TIMEOUT_MS, MAX_VERSION_TIMEOUT_MS;
the 100/60000 bounds now live solely in package.json.
- Tests: drop the resolveVersionTimeout cases; runCodevVersion suite keeps the
explicit-timeout (positive) + default-when-omitted (negative) + spawn-error +
5000 regression-anchor coverage.
Trade-off: no runtime clamp of a hand-edited out-of-range settings.json value
(VSCode UI validation covers the realistic path).
Fix cluesmith#1024: bump CLI preflight timeout to 5s + add configurable override
…stead of blind reset (fixes CI-only e2e race) The iter-5 stale-activeLine reset (useEffect(() => setActiveLine(null), [content])) was unconditional. The initial async load sets content outside the test's act(), so that effect could fire AFTER a hover set activeLine, clobbering it — the + overlay never mounted and the Phase 4 MOUSE e2e test's findByRole timed out. Reproduced only under CI's slower scheduling (local passes 10x full-suite). Fix: validate the overlay anchor against the reloaded DOM (clear activeLine only when its [data-line] element is genuinely absent), folded into the decoration effect keyed on [html]. A valid hovered line survives (no clobber); a removed/shortened block still clears (preserves the iter-5 Codex intent). Added a deterministic regression test proven to fail against the old blind-reset and pass against the validation fix. 34/34 green.
…plan approved (PR consult items) PR consult (re-run on final code) Codex REQUEST_CHANGES, both fixed: - Version lockstep: artifact-canvas was 3.1.7 while the workspace is 3.1.9 (rebase side effect); bumped to 3.1.9 to restore the invariant the release/bump wiring relies on. Lockfile unchanged. - Approved plan artifact still said 'Status: draft' with no approval frontmatter though status.yaml shows plan-approval approved; added frontmatter + flipped Status to approved. No code-behavior change; build + 34 tests green.
… consultation tally (PR iter-2 COMMENTs)
…I-only keyboard test race) 3rd CI-only failure (Phase 3 keyboard test, 'expected -1 to be +0'). Evidence shows the failing assertion is expect(p.tabIndex).toBe(0), NOT onAddComment: markdown-it deterministically yields data-line='0' (proven; data-line.test passes in the same CI run), so onAddComment(-1) is impossible; -1 is a <p>'s default tabIndex. The decoration effect set tabIndex=0 AFTER render and the test read it synchronously when the element appeared, racing the effect under CI's slower scheduling (same race family as the e2e activeLine fix). Fix: stamp tabindex='0' at render time in the renderer core rule (alongside data-line), so focusability is in the HTML the instant a block mounts. Removed the redundant el.tabIndex=0 from the decoration effect. Added a deterministic renderer test for render-time tabindex. Preempts the same latent race in the e2e keyboard test. types 0, build 0, 35/35 ×12 runs green.
Phase 1 of the hot/cold model. Add arch-critical.md and lessons-critical.md
(capped facts + a bounded 'consult when...' map of their cold doc):
- codev/resources/ : real curated codev content (tier-2 instance)
- codev-skeleton/{templates,resources}/ + codev/templates/ : generic starter
(resources/ is the runtime tier-4 fallback read by resolveCodevFile)
Cold docs (arch.md, lessons-learned.md) untouched. Add hot-tier.test.ts
enforcing the cap (<=35 lines, <=10 facts, <=12 map topics), placement,
map structure, and cold-doc presence.
Phase 1 iter-1 CMAP (Codex RC): add a test asserting every map topic in the real hot files names a real top-level section of its cold doc (accuracy, not completeness — the map stays bounded by design). Add the two most decision-relevant omitted arch.md topics (Technology Stack, VS Code Extension), bringing the arch map to the 12-topic cap.
…dex review fix) The renderer stamps the same data-line on nested blocks (ul + li). The injection loop ran per-match, producing a duplicate card stack and invalid ul > ul DOM for list/blockquote/table markers. Anchor to the first (outermost) match per line. Pinned by a regression test that fails without the fix.
vscode: markdown preview inline REVIEW cards + right-edge marker minimap (cluesmith#863)
…dex/gemini architects Fixes a latent crash-loop where a non-Claude architect/builder + a stale Claude .jsonl built an invalid `<cmd> --resume <claude-uuid>` invocation and shellper restart-looped to death. Session resume is now gated on the configured HarnessProvider: - harness.ts: add optional buildResume (bundled discovery + Node-argv + shell-escaped script fragment) and getArchitectFiles. Only CLAUDE_HARNESS implements buildResume; GEMINI_HARNESS writes .gemini/settings.json → AGENTS.md so gemini launches with project context. - tower-instances.ts: architect resume gated on getArchitectHarness().buildResume, preserving the safeToResume sibling guard; getArchitectFiles written if-absent. - spawn.ts / spawn-worktree.ts: discoverResumeSession takes the builder harness and returns the bundled resume object; the launch script consumes the pre-escaped scriptFragment instead of re-deriving the flag. - doctor.ts / arch.md: affirm codex/gemini architect support; document that conversation resume is Claude-main-only and selection is config-driven. Tests: codex/gemini return no --resume with a stale jsonl (architect + builder); claude still resumes; gemini settings.json write-if-missing + no-clobber. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Architect Integration Review — REQUEST CHANGES3-way integration CMAP on the clean feature diff ( Verdicts: codex BlockingB. The CLI-override path re-arms the exact crash-loop this PR fixes (gemini blocking, codex nit — verified) A. Gemini project-context is path-dependent, not architect-wide (codex blocking — verified)
A gemini sibling architect or a no-Tower Nits (fold in while reworking)
Non-blocking, acknowledged
Full per-model verdicts saved alongside the project artifacts. Re-request the Architect integration review |
…are harness + centralized context files BLOCKER B: getArchitectHarness/getBuilderHarness now auto-detect the harness from the override-aware resolved command (getResolvedCommands honoring TOWER_ARCHITECT_CMD / --architect-cmd / --builder-cmd), so a non-claude command override no longer resolves the claude harness and re-arms the resume crash-loop. BLOCKER A: centralize getArchitectFiles writing into the shared buildArchitectArgs (exported writeArchitectContextFiles) and route the no-Tower architect command through it, so sibling / no-Tower / reconnect gemini launches all get .gemini/settings.json — not just first-activation. Nits: gate the resume-skip WARN on buildResume support; distinguish "harness does not support resume" in discoverResumeSession; gitignore .gemini/settings.json (repo + managed adopter list). Adds config.test.ts (override-aware resolution) and tower-utils.test.ts (writeArchitectContextFiles) regression coverage. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…tmatter rebuttal Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Superseded by the upstream cross-fork PR cluesmith#1059 (head |
… the command channel Finding #1 (manifest gap): declare codev.forwardCurrentFileToBuilder and codev.forwardCurrentHunkToBuilder in contributes.commands so they appear in the palette / are keybindable, matching the sibling forwardSelectionToBuilder. Finding cluesmith#2 (workspace scoping): add an optional workspace to CommandRequest; Tower carries it through the broadcast, and the VSCode provider drops a command whose workspace does not match its own getWorkspacePath(). Mirrors the builder-spawned cross-workspace filter. No behavior change until a controller populates the field; the focus-gate alone is insufficient once a second workspace exists.
…cker, perf bound, CJS interop) Iteration 2 of Phase 2, addressing the iter-1 3-way review (Gemini + Claude APPROVE, Codex REQUEST_CHANGES): - Codex #1 (missing claude-picker fixture): add a synthesized claude `/model` picker fixture (claude-picker.busy.txt) whose highlighted row starts with the same ❯ glyph as the composer marker, with normal-intensity model names. Pins that a picker's selection-cursor + list classifies busy via the user-text path, never a false-clean; mirrors the real codex-picker capture (`› 1. …`). Wired into the required-states assertion; suite now 23/23. Documented as synthesized in the fixtures README (sandbox claude is the ez-cli shim, same reason as claude-idle). - Codex cluesmith#2 (perf assertion too loose): replace the single cold-run < 500ms with warm-up + best-of-5 min < 75ms. The min strips JIT/GC/scheduling noise (42.7ms cold vs 14.5ms native steady-state here), so it validates the spec's ≤~50ms seed-cap budget (measured best-of-5 = 19.2ms) instead of flaking. 5x tighter than before; 75ms is the CI-noise ceiling, not a near-budget claim (the logged value is the evidence). - Bonus latent production bug, found while grounding the perf measurement against the compiled dist under native node: @xterm/headless resolves to its CommonJS entry (no exports map / type:module) with non-analyzable named exports, so `import { Terminal }` throws "Named export 'Terminal' not found" under native-node ESM — how the compiled bins run in production. Masked by vitest (vite interop) and dormant until Phase 4 wires the gate. Switch to the default-import form (codebase convention, cf. `import Database from 'better-sqlite3'`) plus a type-only alias for the one type-position use. Refs cluesmith#1313. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-ceiling+memo All three reviewers (Gemini/Codex/Claude) returned REQUEST_CHANGES; all agreed the over-ceiling removal itself is correct and shippable. Fixes: - Memo stale-verdict across a same-agentKey PTY respawn / RingBuffer.clear() (all three, HIGH): the ringToken (currentSeq:partialBytes:...) is only unique WITHIN one monotonic ring, so a token can alias across session instances. CachedVerdict now binds the live session instance too (hit = cached.session===session && token); getSession(tid) is stable per live terminal, so it hits across ticks and misses after a respawn. Test added. - CPU regression: the memo does NOT help the expensive case (Claude #1; Codex OOM). A BUSY held ring repaints every tick -> token changes every tick -> the memo always misses exactly when the ring is largest (~230ms/tick/agent, await-serial). Added a cost-aware backstop backoff: after a big (> BIG_RING_UNITS=4M) not-clean render, the backstop skips re-classifying that agent for an exponential span (<=8 ticks). NEVER a hold - scheduleDrain still classifies fresh the instant the line clears, so delivery latency is unaffected. Test added. - OOM doc corrected (Codex + Claude): the residual is a possible Tower OOM/crash (unbounded allocation), not merely an event-loop stall (xterm chunks + yields). No holding cap added (it would just reintroduce the outage); robust fix = off-thread classify / cluesmith#1047 persistent xterm, out of scope. - Interrupt Ctrl+C was OUTSIDE the submitToSession lock (all three): a concurrent submission's Ctrl+C could kill another composer / run in the 100ms gap. Now the Ctrl+C + settle (via writeMessageToSession delayOffset) + write are one atomic locked section. Corrected the overstated anti-fusion claim (serializes interrupt-vs-escape only, not vs a concurrent mailbox delivery). - spec-1280 T16 predicate (all three): my manifest-dir-touch scoping silently skipped the forgot-the-manifest-entirely case + had a Windows path.sep bug (always skipped). Adopted Claude's portable predicate (/1280/ branch OR touches codev/projects/1280). - stop() now clears verdictMemo/notCleanStreak/scheduledDrains/classifyBackoff (Codex + Claude). cron test asserts target via objectContaining (Claude). Deferred/flagged for the architect: off-thread/memory-bounded classify (cluesmith#1047); the mailbox write edge taking the per-terminal lock to kill interrupt-vs-delivery fusion; the interrupt-throw -> re-deliver duplicate (minor). Full unit suite: 4261 pass / 48 skip / 0 fail. tsc clean.
Architect review finding 1. Enter a newline then `>` and kimi renders `│ > ` / `│ >`: row one empty, row two matching the marker so its `>` is span-exempted. Every cell is whitespace, box chrome, or an exempted marker, so userCells is 0 and the composer reads CLEAN while holding unsent input — a held message would be typed on top of the user's draft. Bounding the region correctly does not help; the draft is real but literally uncountable. So hold on the region's SHAPE instead: a boxed composer taller than one interior row is a multi-line draft. That is only sound if box growth is exclusive to multi-line drafts, which is a claim about kimi, not about our code — so it was measured on real 0.34.0 first (pir-1201-kimi-box-growth.mjs). Idle, single-line draft, `/` menu, `@` picker and the post-reply steady state all hold at one interior row; only the newline drafts grow. The steady state is load-bearing: growth there would hold every later message forever, a liveness bug rather than a fail-safe one. The working states were measured too (pir-1201-kimi-working-states.mjs) — mid- generation, mode chrome, and a draft typed while the agent works are all one row, so "deliver while busy" does not silently become "hold until idle". Placed AFTER the cell scan, not before it, so the count keeps its ground-truth role: a text-bearing multi-row draft still reports `user-text` and every pre-existing fixture verdict is unchanged. Armed by a dedicated `growsWithDraft` profile field rather than by `regionStartPatterns` (CMAP: codex #1, claude Q5). The two are unrelated properties that merely coincide for kimi, and the hazard is concrete: the shipped codex-idle.clean.txt capture — a real, genuinely EMPTY composer — already spans two interior rows, so arming on the scan bound would have killed codex delivery the day anyone declared a region start for it. The rule now needs both opt-ins, and the inertness tests run on that real capture under four profile variants. Also: `isClassifierStuck` enumerated details as a closed || chain, so widening the union never forced a decision — now a Record keyed by the union, making the next new detail a compile error rather than a silent false (claude F2). Full suite 4906 passed / 48 skipped / 0 failed.
Architect finding 4. cluesmith#1267's contract is "clean exit -> fresh rerun, no recovery", and main's claude loop enforces it BY IDENTITY: a clean exit mints a new session id and the superseded one is never named again. kimi cannot mint on demand and `-c` is cwd-scoped, so identity was never pinned — the guard only asked whether ANY session existed for this cwd. 0.33+ mints no session until the first message lands, so a crash between a clean-exit relaunch and the first delivery found the just-ended conversation still the newest, continued it, and delivered the re-queued task into the conversation the human walked away from — cluesmith#1267's own motivating defect class. The probe now answers WHICH session rather than WHETHER one exists: it prints the newest resumable id for the cwd. The clean-exit branch records that id, and the crash branch takes `-c` only once the newest id differs. Boolean uses derive from "printed something", so there is still one probe and one mirror. Measured before building, since the design assumes `-c` targets the newest session and the existing probe only covered the zero-session case: two live sessions in one cwd on 0.34.0, two oracles — content (codewords ALPHA/BRAVO -> BRAVO) and store identity (only the newest session's dir was touched, nothing new minted, exit 0, no prompt). pir-1201-kimi-continue-newest-probe.mjs. CMAP found a defect this change INTRODUCED (claude F1, codex cluesmith#2, blocking): moving the decision from $? onto stdout meant anything else writing to stdout counted as a session. Measured with NODE_OPTIONS=--require preloading a module that prints — the probe exits 1, the script read RESUME, and `kimi -c` with nothing to continue starts a session that never saw --agent-file. Silently roleless, the cluesmith#929 class, produced by the guard's own upgrade. Now consumes both signals. The sketch's "empty on any error is fail-closed" was also wrong (claude F2, codex #1): a TRANSIENT probe failure records '' and the next crash sees the ended session as different-from-empty. Failure and empty store are now told apart by status, and an unknown baseline blocks resume until the next clean exit re-establishes one. Two probe/discovery divergences fixed rather than documented: `j.cwd ?? j.workDir` short-circuited where readStateJson falls through per-field, and the probe stripped a trailing slash before realpathSync while sameDir does not (the unsafe direction — realpathSync already normalizes one for any directory that exists, so the strip bought nothing). Tests: the composition is now driven for real — the actual `while` loop with stubbed launches, asserting resume,fresh,fresh — because injecting the superseded id from the test left the generated assignment pinned only by a string match. Non-vacuity is demonstrated by running the pre-fix predicate against the same store. Full suite 4915 passed / 48 skipped / 0 failed.
PIR Review: Support
codexandgeminiCLIs as architectsFixes cluesmith#929
Summary
Brings the OpenAI
codexand GooglegeminiCLIs to parity withclaudeas Codev architects, selectable via.codev/config.json(shell.architect/shell.architectHarness). The core fix routes session-discovery +--resumeargument construction behind a new optionalHarnessProvider.buildResumecapability, eliminating a latent crash-loop where a non-Claude architect (or resumed builder) with any stale Claude.jsonlbuilt an invalid<cmd> --resume <claude-uuid>invocation and shellper restart-looped to death. Gemini additionally gets a write-if-absent.gemini/settings.jsonso it launches with project context (AGENTS.md), anddoctornow affirms codex/gemini architect support.Files Changed
Resume seam + gemini context (initial implementation):
packages/codev/src/agent-farm/utils/harness.ts—buildResume?+getArchitectFiles?on the interface;CLAUDE_HARNESS.buildResume(delegates tofindLatestSessionId);GEMINI_HARNESS.getArchitectFiles(.gemini/settings.json)packages/codev/src/agent-farm/servers/tower-instances.ts— architect resume gated ongetArchitectHarness(...).buildResume?.(); fresh path delegates context-file writing tobuildArchitectArgspackages/codev/src/agent-farm/commands/spawn.ts—discoverResumeSessiontakes the builder harness, returns the bundled resume object; both call sites passgetBuilderHarness(...); distinct "harness does not support resume" log (nit 2)packages/codev/src/agent-farm/commands/spawn-worktree.ts—startBuilderSession'sresumeSessionId?: string→resume?: { sessionId, scriptFragment }; script emits the pre-escaped fragmentpackages/codev/src/commands/doctor.ts— affirm codex/gemini architect support; single resolved-harness checkIntegration-review fixes (architect punch list — 2 blockers + 3 nits):
packages/codev/src/agent-farm/utils/config.ts— BLOCKER B:getArchitectHarness/getBuilderHarnessnow auto-detect from the override-aware command (getResolvedCommands);getResolvedCommands.architecthonorsTOWER_ARCHITECT_CMDpackages/codev/src/agent-farm/servers/tower-utils.ts— BLOCKER A: exportedwriteArchitectContextFiles, called from the sharedbuildArchitectArgsso every launch path writes gemini's manifest; nit 1: (see tower-instances) WARN gated on resume supportpackages/codev/src/agent-farm/commands/architect.ts— BLOCKER A: no-Tower path refactored to callbuildArchitectArgs(was duplicating injection).gitignore,packages/codev/src/lib/gitignore.ts— nit 3: ignore.gemini/settings.json(repo + managed adopter list)Tests:
packages/codev/src/agent-farm/__tests__/tower-instances.test.ts— architect resume-skip regression guard + geminigetArchitectFileswrite-if-missing/no-clobberpackages/codev/src/agent-farm/__tests__/spawn-worktree.test.ts— builder resume script uses escapedscriptFragment; codex/gemini → fresh scriptpackages/codev/src/agent-farm/__tests__/discover-resume-session.test.ts— harness-arg threading; codex/gemini null-return + claude bundled-object casespackages/codev/src/agent-farm/__tests__/config.test.ts— BLOCKER B regression: override-aware harness resolution (TOWER_ARCHITECT_CMD / --architect-cmd / --builder-cmd → non-claude harness, nobuildResume)packages/codev/src/agent-farm/__tests__/tower-utils.test.ts— BLOCKER A regression:writeArchitectContextFilesgemini write + no-clobber + claude no-oppackages/codev/src/agent-farm/__tests__/af-architect.test.ts— updated mocks for thebuildArchitectArgsdelegationpackages/codev/src/__tests__/gitignore.test.ts,update.test.ts— managed-entry expectations include.gemini/settings.jsonDocs / artifacts:
codev/resources/arch.md— supported-architect-harnesses + Claude-only-resume + override-aware resolution +getArchitectFilescentralizationcodev/plans/...,codev/reviews/...,codev/state/pir-929_thread.md,codev/resources/lessons-learned.md,codev/projects/929-*/status.yamlCommits
69cf20de[PIR 929][Phase: implement] feat: harness-gated session resume for codex/gemini architects53374f30[PIR Supportcodexas an architect cluesmith/codev#929] Plan revised — address architect feedback (5 issues)fdddc7e2[PIR Supportcodexas an architect cluesmith/codev#929] Plan draftTest Results
pnpm build: ✓ pass (clean TS types)pnpm vitest run(full suite): ✓ 3338 passed, 48 skipped, 0 failuresafx sendmultiline/interrupt/streaming, reconnect, affinity, builder--resume, dashboard scrollback) was exercised by the human at thedev-approvalgate against the running worktree — the reason PIR was chosen over AIR/BUGFIX. The architect's subsequent integration review caught the two override/path-dependency blockers below (fixed + regression-tested in this PR).Architecture Updates
COLD (
codev/resources/arch.md) — updated in the implementation commit. Added a "Supported Architect Harnesses & Conversation Resume (cluesmith#929)" subsection documenting: (1) claude/codex/gemini are all supported architects selected via.codev/config.json(notTOWER_ARCHITECT_CMD/--architect-cmd); (2) gemini's.gemini/settings.json→AGENTS.mdcontext manifest; (3) conversation resume is Claude-main-only viaHarnessProvider.buildResume, and the crash-loop it fixes. Also updated the role-injection step to point at theHarnessProviderper-CLI flags rather than the claude-only--append-system-prompt.No HOT (
arch-critical.md) change: the harness abstraction and its provider-method-extension pattern are already implied by the existing "Forge concept commands abstract the VCS provider — add a dedicated concept" entry's spirit; this PR extends an existing abstraction (Spec 591) rather than introducing a new always-on invariant, so a cold-tier reference detail is the correct routing.Lessons Learned Updates
COLD (
codev/resources/lessons-learned.md, Architecture section) — added one lesson: when abstracting per-CLI behavior behind a provider, every call site that builds a CLI invocation must route through the provider — including resume/restart paths, not just the obvious fresh-launch path. The resume seam was the one path Spec 591 left harness-blind, and it only crash-loops on the--resumebranch (fresh launches were already correct), which is why "builders already prove the path" didn't cover it.No HOT (
lessons-critical.md) change: the existing "Single source of truth beats distributed state" and "Model permissions as roles/capabilities, not booleans" hot entries already carry the general displace-when-full discipline; this is a spec-narrow recipe (audit all invocation seams when extending a provider) better suited to the cold archive.Things to Look At During PR Review
buildResumebundling decision (harness.ts): one method returns both the Node-argvargs(for thespawn()architect site) and a shell-escapedscriptFragment(for the builder bash generator), mirroringbuildRoleInjection/buildScriptRoleInjection. This deliberately avoids a second independently-optional method (which would force a!non-null assertion) and avoids.join(' ')-ing a raw argv into bash (word-split/quoting bug). Session ids are bare UUIDs today, so the escaping is belt-and-suspenders — kept for correct-by-construction consistency with the existing script-injection methods.safeToResumeinteraction (tower-instances.ts): the new harness gate composes with the pre-existing sibling-collision guard (safeToResume, Multi-architect conversation resume: disambiguate via per-architect session UUID cluesmith/codev#832) — resume happens only when both the harness implementsbuildResumeand no persisted siblings exist. Confirm the ordering reads correctly.getArchitectFileswrite-if-absent (tower-instances.ts): writes.gemini/settings.jsononly when the target path doesn't exist, so a user's existing file is never clobbered. Test covers both the write and the no-clobber path.getResolvedCommands.architectis nowcliOverrides.architect || TOWER_ARCHITECT_CMD || config. Within the Tower processcliOverridesis empty (it's set in the spawningafxprocess, not the long-lived server), so this matches the launch site'sTOWER_ARCHITECT_CMD || config. An explicitshell.architectHarness/shell.builderHarnessstill wins over auto-detection by design — so a deliberately contradictoryarchitectHarness: claude+ gemini command is the user's call, not auto-resolved. Worth a sanity check that this precedence reads as intended.getArchitectFilescentralization (BLOCKER A fix): moved the inline write out oflaunchInstanceinto the sharedbuildArchitectArgs(writeArchitectContextFiles), and refactored the no-Towerarchitect.tsto callbuildArchitectArgsinstead of duplicating role injection. Confirm the no-Tower path's arg shape is unchanged (covered byaf-architect.test.ts) and that the claude resume path — the one path that does not callbuildArchitectArgs— correctly needs no context files (claude has nogetArchitectFiles).Consultation Findings & Dispositions
The PR diff was reviewed by a 2-way advisory CMAP pass after the integration-review fixes landed:
codev/plans/929-...mdhas no YAML approval frontmatter (approved:/validated:)."plan-approvalgate (recorded incodev/projects/929-*/status.yaml:plan-approval: approved 2026-05-31) — the gate is the approval record for builder-authored plans. None of the existing merged plans incodev/plans/carry that frontmatter either (verified:0001–0009start with a#heading /## Metadata, noapproved:key). Adding a self-authoredapproved:/validated:block would fabricate an approval record that porch already holds authoritatively. No code change warranted. Escalated to the human at theprgate per PIR single-pass policy.How to Test Locally
For reviewers pulling the branch:
pir-929→ Review Diffafx dev pir-929shell.architectaccordingly):afx workspace startmain architect launches with a stale Claude.jsonlpresent in~/.claude/projects/<encoded-cwd>/— must NOT crash-loop, and no--resumein the launched command (primary regression target)afx architect(no-Tower) +afx workspace add-architectlaunch with role injected.gemini/settings.jsonwritten withcontext.fileName: "AGENTS.md"(pre-existing one untouched)afx sendsingle-line / multi-line (>3 lines) /--interrupt/ while streamingafx spawn <id> --resumeon a non-Claude builder → fresh launch + resume notice, inspect.builder-start.shfor no--resume <claude-id>