Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): never prune slashdo's multi-reviewer wrapper
[._.]/ Adam Eivy8ca8f066dcfe
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 13509e49bb..21f358fe0f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -91,6 +91,6 @@## CoS agents-- **[issue-3110] A task that runs a bundled slashdo workflow no longer pastes the whole 250KB procedure into the agent's prompt.** Dispatching `/do:review` or `/do:better` handed the agent its fully-expanded command body — 258KB, roughly 65k tokens — on every single spawn, which on a smaller model could crowd out or overflow the context the actual work needed. Most of that bulk was never reachable: each of those commands carries all five of slashdo's reviewer loops (Copilot, arbitrary GitHub reviewer, local CLI agent, local model, and the multi-reviewer wrapper) though one run drives exactly one of them. When your reviewers are known — pinned on the task, or set in Code Review Defaults — the unreachable loops are now dropped, cutting 37% off `/do:review` (258KB down to 163KB) and 45% off `/do:depfree`; the run is given an explicit `--review-with` so it can't pick a reviewer whose procedure was left out. Whatever is still oversized is written to disk once and handed to the agent as a file path to read, instead of pasted. Nothing is pruned when the reviewer set isn't known — an over-trimmed prompt that drops the loop the agent needed would be worse than a fat one — and API providers, which have no file tools, still get the body inlined (now with a log line naming the command and its size, so the cost is visible rather than silent).+- **[issue-3110] A task that runs a bundled slashdo workflow no longer pastes the whole 250KB procedure into the agent's prompt.** Dispatching `/do:review` or `/do:better` handed the agent its fully-expanded command body — 258KB, roughly 65k tokens — on every single spawn, which on a smaller model could crowd out or overflow the context the actual work needed. Most of that bulk was never reachable: each of those commands carries all five of slashdo's reviewer loops (Copilot, arbitrary GitHub reviewer, local CLI agent, local model, and the multi-reviewer wrapper) though one run drives exactly one of them. When your reviewers are known — pinned on the task, or set in Code Review Defaults — the unreachable loops are now dropped, cutting 23% off `/do:review` (258KB down to 199KB) and 28% off `/do:depfree`; the run is given an explicit `--review-with` so it can't pick a reviewer whose procedure was left out. Whatever is still oversized is written to disk once and handed to the agent as a file path to read, instead of pasted. Nothing is pruned when the reviewer set isn't known — an over-trimmed prompt that drops the loop the agent needed would be worse than a fat one — and API providers, which have no file tools, still get the body inlined (now with a log line naming the command and its size, so the cost is visible rather than silent).- **Antigravity (agy) agents no longer die on the first-run folder-trust gate.** An agy agent launched in a fresh worktree could fail immediately with `Do you trust the contents of this project?` and a `paste-not-rendered` error, having done nothing. The spawner waits for a positive "input box is live" signal before pasting the task prompt, and for claude that signal — the terminal's bracketed-paste mode turning back on — arrives exactly when its composer appears. agy turns it on much earlier, when it enters full-screen mode, while it is still signing in and before its trust prompt has even drawn. So on any run where agy's sign-in outlasted the startup delay, the prompt was pasted into a screen that wasn't ready; the trust menu then appeared and swallowed it along with all three retries, and because the trust prompt hadn't been seen yet the auto-confirm never fired. agy now additionally waits for its composer footer, which only draws once the trust gate is resolved, so the trust prompt is confirmed first and the prompt lands in the input box. (`--dangerously-skip-permissions` does not bypass this gate, contrary to what the code previously assumed.)- Handshake markers are now matched against a rolling window of recent terminal output rather than a single read, so a prompt or footer that arrives split across two reads is still recognized.diff --git a/server/lib/slashdoInvocation.js b/server/lib/slashdoInvocation.jsindex b78cfb622b..c2d211e017 100644--- a/server/lib/slashdoInvocation.js+++ b/server/lib/slashdoInvocation.js@@ -41,8 +41,8 @@ export const SLASHDO_NAMESPACE = 'do';* pointer at a resolved copy on disk instead (see `buildSlashdoSection`).** 24,000 chars ≈ 6k tokens. Every current bundled command is far over it even- * after pruning (`review` measures 258,260 chars raw, 162,677 pruned to one- * reviewer loop, 112,269 with every reviewer loop dropped), which is the intent:+ * after pruning (`review` measures 258,260 chars raw, 198,997 pruned to one+ * reviewer, 112,269 with every reviewer include dropped), which is the intent:* the budget exists so a future SMALL command still inlines. The budget-pin test* in `slashdoInvocation.test.js` asserts this against the measured sizes, so a* slashdo release that shrinks a command can't silently flip it back to inlining@@ -54,15 +54,21 @@ export const SLASHDO_INLINE_BUDGET_CHARS = 24000;* slashdo lib includes that are REVIEWER VARIANTS — one loop per reviewer kind,* all five pasted into `review` / `better` / `pr` / `release` / `depfree` though* a given run drives exactly one. Pruning the unreachable ones is where the real- * prompt saving is — pruning to a single CLI reviewer measured -37% on `review`,- * -43% on `pr`, -45% on `depfree`; the file pointer is the backstop for the rest.+ * prompt saving is — pruning to a single CLI reviewer measured -23% on `review`,+ * -27% on `pr`, -28% on `depfree`; the file pointer is the backstop for the rest.** Keyed by the PortOS reviewer slug (`REVIEWER_VALUES` in `cosValidation.js`) so* the keep-set derives from already-resolved run settings. `copilot` and the* arbitrary-`@login` loop are GitHub-side; `claude`/`codex`/`antigravity`/`grok`* all share slashdo's one local-agent loop; `ollama`/`lmstudio` are the- * local-model loop. `multi-reviewer-loop` is the wrapper — only reachable with- * 2+ review sources.+ * local-model loop.+ *+ * `multi-reviewer-loop` is the ORCHESTRATION WRAPPER, not a per-reviewer variant:+ * slashdo's commands hand off to it for any non-empty reviewer list, and its own+ * spec says `{REVIEW_AGENTS}` "may contain a single entry". So it is listed here+ * (it is prunable in principle — a run with no reviewers at all doesn't reach it)+ * but `unreachableReviewerIncludes` never drops it once a reviewer resolves.+ * Pruning it for a lone reviewer left the inner loop with nothing to dispatch it.*/export const SLASHDO_REVIEWER_INCLUDES = Object.freeze({copilot: 'copilot-review-loop',@@ -110,8 +116,9 @@ export function unreachableReviewerIncludes({ reviewers = null, usernames = [] }else return [];}if (users.length) keep.add(SLASHDO_REVIEWER_INCLUDES.username);- // The wrapper is only reachable with more than one review source to sequence.- if (reviewers.length + users.length > 1) keep.add(SLASHDO_REVIEWER_INCLUDES.multi);+ // Always kept: slashdo's commands dispatch EVERY non-empty reviewer list+ // through the wrapper, single-entry lists included (see SLASHDO_REVIEWER_INCLUDES).+ keep.add(SLASHDO_REVIEWER_INCLUDES.multi);return SLASHDO_REVIEWER_INCLUDE_NAMES.filter(name => !keep.has(name));}diff --git a/server/lib/slashdoInvocation.test.js b/server/lib/slashdoInvocation.test.jsindex 53d8e03552..f914534042 100644--- a/server/lib/slashdoInvocation.test.js+++ b/server/lib/slashdoInvocation.test.js@@ -273,16 +273,26 @@ describe('unreachableReviewerIncludes', () => {expect(unreachableReviewerIncludes({ reviewers: ['codex', 'some-future-reviewer'] })).toEqual([]);});- it('keeps only the local-agent loop for a lone CLI reviewer', () => {+ it('keeps the local-agent loop (and the wrapper) for a lone CLI reviewer', () => {const skipped = unreachableReviewerIncludes({ reviewers: ['codex'] });expect(skipped).not.toContain(SLASHDO_REVIEWER_INCLUDES.localAgent);- // Single reviewer ⇒ the multi-reviewer wrapper is unreachable too.- expect(skipped).toContain(SLASHDO_REVIEWER_INCLUDES.multi);expect(skipped).toContain(SLASHDO_REVIEWER_INCLUDES.copilot);expect(skipped).toContain(SLASHDO_REVIEWER_INCLUDES.localModel);expect(skipped).toContain(SLASHDO_REVIEWER_INCLUDES.username);});+ it('never prunes the orchestration wrapper for a resolved reviewer, single or not', () => {+ // slashdo dispatches EVERY non-empty reviewer list through+ // multi-reviewer-loop ("may contain a single entry"), so pruning it for a+ // lone reviewer left the inner loop with nothing to dispatch it.+ for (const reviewers of [['codex'], ['copilot'], ['ollama'], ['codex', 'copilot']]) {+ expect(unreachableReviewerIncludes({ reviewers }))+ .not.toContain(SLASHDO_REVIEWER_INCLUDES.multi);+ }+ expect(unreachableReviewerIncludes({ reviewers: [], usernames: ['octocat'] }))+ .not.toContain(SLASHDO_REVIEWER_INCLUDES.multi);+ });+it('maps every CLI reviewer onto the one shared local-agent loop', () => {for (const slug of ['claude', 'codex', 'antigravity', 'grok']) {expect(unreachableReviewerIncludes({ reviewers: [slug] }))@@ -297,14 +307,6 @@ describe('unreachableReviewerIncludes', () => {}});- it('keeps the multi-reviewer wrapper as soon as there are two review sources', () => {- expect(unreachableReviewerIncludes({ reviewers: ['codex', 'copilot'] }))- .not.toContain(SLASHDO_REVIEWER_INCLUDES.multi);- // One keyed reviewer + one @login is also two sources.- expect(unreachableReviewerIncludes({ reviewers: ['codex'], usernames: ['octocat'] }))- .not.toContain(SLASHDO_REVIEWER_INCLUDES.multi);- });-it('keeps the arbitrary-@login loop only when a username reviewer is present', () => {expect(unreachableReviewerIncludes({ reviewers: ['codex'], usernames: ['octocat'] })).not.toContain(SLASHDO_REVIEWER_INCLUDES.username);@@ -364,8 +366,10 @@ describe('SLASHDO_INLINE_BUDGET_CHARS pin against the bundled commands', () => {skipIncludes: unreachableReviewerIncludes({ reviewers: ['codex'] }),});// Shape, not an exact byte count: pruning must be a real double-digit-percent- // reduction, and must not be a no-op that quietly stopped working.- expect(pruned.length).toBeLessThan(full.length * 0.75);+ // reduction, and must not be a no-op that quietly stopped working. Measured+ // -23% for a lone CLI reviewer (258,260 → 198,997) — the orchestration+ // wrapper is deliberately never pruned, which costs ~37KB of the ceiling.+ expect(pruned.length).toBeLessThan(full.length * 0.85);// The kept loop is still there and the omission is announced, not silent.expect(pruned).toContain('not applicable to this run');expect(pruned).not.toContain(`\`${SLASHDO_REVIEWER_INCLUDES.localAgent}\` omitted`);diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex cf281d6fbf..f71ded4c82 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -313,9 +313,10 @@ export function reconcileSplitContext(task) {** 1. **Prune unreachable reviewer variants.** `review`/`better`/`pr` each paste* all five of slashdo's reviewer loops though one run drives one of them.- * Pruning to a single CLI reviewer measured -37% on `review` (258,260 →- * 162,677 chars), -43% on `pr`, and -45% on `depfree`; dropping every reviewer- * loop reaches -57%. This is where the saving actually is.+ * Pruning to a single CLI reviewer measured -23% on `review` (258,260 →+ * 198,997 chars), -27% on `pr`, and -28% on `depfree`. (slashdo's+ * orchestration wrapper is never pruned — it dispatches even a single-entry+ * reviewer list — which is ~37KB of the theoretical ceiling.)* 2. **Point at a resolved copy on disk when still over budget** — but only for a* host with file tools (`cli`/`tui`; an HTTP `api` provider has none and* inlines with a warning). On its own this is roughly token-NEUTRAL for an