@yeison.restrepo.r/code-conductor 1.52.8 → 1.52.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -500,8 +500,6 @@ The backup and temp rules keep the installer's own backups and crash-stranded te
500
500
  - **`[BUG-071]`, open:** the OpenCode guard plugin forwards only `command` from OpenCode's `bash` call, so if that tool runs a command in another working directory, Guard 3 evaluates it as if it ran in the project root. Until it is fixed, treat Guard 3 under OpenCode as best-effort for commands that set their own working directory.
501
501
  - **`[BUG-074]`, open:** the `/cc-orchestrate` role definitions disagree on when a task's tests are done: `code` may hand back `build_executed` on a red suite, `plan` requires each task to end green, and `qa` passes only on exit 0, so one suite result gates differently depending on the role. Until it is fixed, read a `build_executed` hand-back's reported suite exit code yourself and treat a non-zero one as not done.
502
502
  - **`[BUG-078]`, open:** `scripts/orchestrate.mjs` builds a fix round's write scope with the approved plan included, so Guard 5 lets the fix-round `code` agent write to the plan and only the brief's instruction stops it; any change other than checkbox ticks still halts the run with `ORCH_APPROVED_DOC_CHANGED` on the next `install audit` or fix round, and ticks do not affect `tasks.done`. Until it is fixed, check after a fix round that the approved plan's checkboxes are unchanged.
503
- - **`[BUG-079]`, open:** `scripts/orchestrate.mjs` stores every non-security hand-back's full SNAP in `.claude/memory/orchestrator-run.json` with a 64 KiB cap per SNAP but no cap on the total, so a plan of roughly 80 or more tasks with maximally sized hand-backs can push the run file past the hook's 10 MiB read cap, after which `readRunFile` returns null and Guard 6 downgrades from deny to warn for the rest of the run. Until it is fixed, keep orchestrated plans well under 80 tasks, or split a larger item into several runs.
504
- - **`[BUG-088]`, open:** when `code-conductor --opencode` replaces a symlink at `.opencode/plugin/conductor-guard.js`, `lib/installer/deploy.mjs` prints the old link text to stderr verbatim, so a crafted checkout's link target can carry ANSI escape sequences or newlines that spoof or hide part of the installer's terminal output; it does not execute code or write files. Until it is fixed, inspect that path (`ls -l .opencode/plugin/conductor-guard.js`) in an untrusted checkout before installing with `--opencode`, and do not trust installer output that follows a symlink-replacement warning.
505
503
  - **The `P7` false positive** described under [Guard 3, and what it learned](#guard-3-and-what-it-learned) is still live.
506
504
  - **A re-run against an untouched `project.md` prints a recovery hint it cannot prove is needed.** If you install, never write anything into `.claude/memory/project.md`, and install again, you get a line suggesting the file may have been overwritten by a pre-`1.30.0` re-run. It was not; it equals the stub because it was seeded and never edited. The check compares content and **cannot distinguish "seeded and untouched" from "clobbered"**, which is why the wording is hedged to "may have been" rather than "was". This residual is named and accepted in [`BUG-039`'s spec at `:129`](docs/superpowers/specs/2026-09-27-bug039-installer-host-owned-state-design.md), where the alternative (restoring from the host's own git history) was rejected as writing host files out of the host's history with new failure modes. A **fresh** install is silent, which the Quickstart shows.
507
505
  - **Three open dossiers**, which are the evidence-collection pipeline working rather than a backlog: a session denial tally, one for interleaved-artifact reports, and an intermittent commit-hook hang in the `snap-build` suite. A dossier holds specimens until a mechanism is characterized by probe; an id is minted only when the written condition is met. `[BUG-047]` is what that pipeline produces when it completes: an out-of-scope note, then a dossier, then four specimens across four sessions, then a mint, then a release.
@@ -242,6 +242,11 @@ const PLUGIN_IN_PLACE = new Set(['created', 'merged', 'unchanged']);
242
242
  // still backs up a copy the host edited before replacing it (BUG-069).
243
243
  const replaceWithTemplate = (templateText, hostText) => ({ text: templateText, changed: hostText !== templateText });
244
244
 
245
+ // The link text comes from the checkout, so a raw control character in it could erase or
246
+ // forge installer output; C1 is included because U+009B acts as CSI on some terminals (BUG-088).
247
+ const escapeControlChars = (text) =>
248
+ text.replace(/[\x00-\x1f\x7f-\x9f]/g, (c) => `\\x${c.charCodeAt(0).toString(16).padStart(2, '0')}`);
249
+
245
250
  // The plugin is a managed asset, so a link at its path is removed, never followed:
246
251
  // writing through it would overwrite whatever file the checkout points it at (BUG-087).
247
252
  // Returns false when the link is still there, so nothing may be written.
@@ -257,7 +262,7 @@ function removePluginSymlink(pluginPath, warn) {
257
262
  warn(`code-conductor: skipping ${OPENCODE_PLUGIN} — it is a symlink and could not be removed (${err.code}); nothing was written`);
258
263
  return false;
259
264
  }
260
- warn(`code-conductor: replaced the symlink at ${OPENCODE_PLUGIN} (it pointed to ${linkText}) with the shipped plugin; the file it pointed to was not touched`);
265
+ warn(`code-conductor: replaced the symlink at ${OPENCODE_PLUGIN} (it pointed to ${escapeControlChars(linkText)}) with the shipped plugin; the file it pointed to was not touched`);
261
266
  return true;
262
267
  }
263
268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeison.restrepo.r/code-conductor",
3
- "version": "1.52.8",
3
+ "version": "1.52.10",
4
4
  "description": "A governance layer for Claude Code sessions: hooks that check an agent's commands before they run, a spec-first workflow, and project memory the next session reads.",
5
5
  "keywords": [
6
6
  "agentic-development",
@@ -34,7 +34,7 @@ A halt stops the run (D12, amended by FEAT-055). Recovery is `node "$S/orchestra
34
34
 
35
35
  `install code|audit|qa` halts `ORCH_APPROVED_DOC_CHANGED` when the approved spec or plan changed after its approval (a ticked plan checkbox is not a change), and `ORCH_APPROVAL_UNHASHED` on a run whose approvals were recorded before FEAT-056. Recovery for both is `end`, then `start`. `install security` halts the same two codes.
36
36
 
37
- `handback <role>` halts `ORCH_HANDBACK_SCOPE_MISMATCH` when the hand-back's `ops.scope` is not the scope `install` wrote for that position, entry for entry and in the same order, or when `audit`, `security` or `qa`, which are installed with no scope, hand back one; and `ORCH_HANDBACK_OUT_OF_SCOPE` when a path in `ops.f` is absolute, has an empty, `.` or `..` segment, or lies outside that scope. The script recomputes the scope from the plan and the run's pinned folders; it never reads it back from `.claude/memory/band-envelope.json`. Neither halt records the hand-back. For both, name the hand-back file you passed: it is what the owner reads next. Recovery is `resume` or `end`, then `start`.
37
+ `handback <role>` halts `ORCH_HANDBACK_SCOPE_MISMATCH` when the hand-back's `ops.scope` is not the scope `install` wrote for that position, entry for entry and in the same order, or when `audit`, `security` or `qa`, which are installed with no scope, hand back one; and `ORCH_HANDBACK_OUT_OF_SCOPE` when a path in `ops.f` is absolute, has an empty, `.` or `..` segment, or lies outside that scope. The script recomputes the scope from the plan and the run's pinned folders; it never reads it back from `.claude/memory/band-envelope.json`. Neither halt records the hand-back. For both, name the hand-back file you passed: it is what the owner reads next. Recovery is `resume` or `end`, then `start`. `handback <role>` also halts `ORCH_RUN_FILE_FULL` when recording the hand-back would carry the run file past `RUN_FILE_MAX_BYTES` (8388608 bytes), the bound that keeps it under the hooks' read cap; the hand-back is not recorded, and recovery is `end`, then `start` with a smaller plan, because `resume` keeps the stored records and the redone hand-back halts again.
38
38
 
39
39
  `handback audit` halts `ORCH_VERDICT_MISSING`, `ORCH_VERDICT_INVALID` or `ORCH_VERDICT_INCONSISTENT` when the audit report's `VERDICT:` line is absent, malformed, misplaced or contradicts its findings; `ORCH_AUDIT_RETURN` when the audit returned the change and the run has no fix rounds left; `ORCH_AUDIT_ESCALATE` when the audit escalated a decision to the owner, at any round; and `ORCH_FIX_SCOPE_UNAPPROVED` when a blocker or major finding of a returned audit names a file outside the approved plan's task files, or the approved spec or plan. For those six, also name `.conductor/handback/audit-<round>.txt`: its findings are what the owner reads next. `handback qa` halts `ORCH_GATE_WITHHELD` when the run's last audit entry carries no `VERDICT: APPROVE`. Recovery for all seven is `end`, then `start`.
40
40
 
@@ -110,6 +110,8 @@ export const DELEGATE_DIR = '.conductor/delegate';
110
110
  export const AUDIT_ROUNDS_DEFAULT = 2;
111
111
  const AUDIT_ROUNDS_MAX = 5;
112
112
  const SNAP_STORE_MAX_BYTES = 64 * 1024;
113
+ // BUG-079: the hooks stop reading the run file at 10 MiB; the 2 MiB below that is for the unchecked writes after a hand-back (a halt, approvals, dispatch fields).
114
+ export const RUN_FILE_MAX_BYTES = 8 * 1024 * 1024;
113
115
  const isAuditRounds = (n) => Number.isInteger(n) && n >= 0 && n <= AUDIT_ROUNDS_MAX;
114
116
  // FEAT-053: the Agent tool's model aliases plus inherit; the one list start, the profiles and isValidRun are checked against.
115
117
  export const MODEL_ALIASES = ['opus', 'sonnet', 'haiku', 'inherit'];
@@ -236,7 +238,18 @@ function readRun(root) {
236
238
  return run;
237
239
  }
238
240
 
239
- const saveRun = (root, run) => writeAtomic(join(root, RUN_FILE), JSON.stringify(run, null, 2) + '\n');
241
+ const serializeRun = (run) => JSON.stringify(run, null, 2) + '\n';
242
+ const saveRun = (root, run) => writeAtomic(join(root, RUN_FILE), serializeRun(run));
243
+
244
+ // BUG-079: a hand-back stores its SNAP, so it is the write that could carry the run file past the hooks' read cap.
245
+ function saveHandedBackRun(root, run, role) {
246
+ const text = serializeRun(run);
247
+ const bytes = Buffer.byteLength(text);
248
+ if (bytes > RUN_FILE_MAX_BYTES) {
249
+ throw new Halt('ORCH_RUN_FILE_FULL', `the run file would be ${bytes} bytes with this ${role} hand-back, over the ${RUN_FILE_MAX_BYTES}-byte bound that keeps it readable by the hooks; end, then start with a smaller plan`);
250
+ }
251
+ writeAtomic(join(root, RUN_FILE), text);
252
+ }
240
253
 
241
254
  // Every verb but start, resume and end drives a run that must exist, be this session's, and not be halted.
242
255
  function liveRun(root, sessionId) {
@@ -1014,7 +1027,7 @@ async function handback(root, sessionId, role, bytes) {
1014
1027
  if (role === 'security') return securityHandback(root, run, env.ops.gate, text);
1015
1028
  const verdict = role === 'audit' ? parseVerdict(text) : null;
1016
1029
  const recorded = recordHandback(run, role, env.ops.gate, verdict?.verdict, { snap });
1017
- saveRun(root, recorded);
1030
+ saveHandedBackRun(root, recorded, role);
1018
1031
  // Saved first, so the halt cli records lands on top of the audit entry (FEAT-060, FEAT-057).
1019
1032
  if (verdict && verdict.verdict !== 'APPROVE') return auditFix(root, recorded, verdict, bytes);
1020
1033
  const note = recorded.handbacks.at(-1).security === SECURITY_NOT_CONFIGURED ? `; security=${SECURITY_NOT_CONFIGURED}` : '';