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
fix: lift every agy print flag when re-anchoring, not just the last one
[._.]/ Adam Eivy848c94f0755f
diff --git a/server/lib/antigravity.js b/server/lib/antigravity.jsindex ce80e6d068..a8cf3d96ad 100644--- a/server/lib/antigravity.js+++ b/server/lib/antigravity.js@@ -201,23 +201,25 @@ const NOOP_CLEANUP = () => {};* no-op for the already-trailing case.** The flag's original SPELLING is preserved (`-p` / `--prompt` / `--print`) so a- * user-baked short form still reaches agy as they wrote it.+ * user-baked short form still reaches agy as they wrote it — the LAST spelling+ * wins, matching which flag agy itself would have honored.+ *+ * EVERY print flag is lifted, not just the last one. `ensureAntigravityPrintArgs`+ * strips baked print flags from the provider's saved argv, but the `extraArgs`+ * concatenated on afterwards are never stripped — so leaving an earlier `-p`+ * behind would have agy consume the token following IT as the prompt.** @param {string[]} args - argv as built by ensureAntigravityPrintArgs* @param {string} prompt - the full prompt text* @returns {{ args: string[], useStdin: false, cleanup: () => void }}*/export function prepareAntigravityPrompt(args = [], prompt = '') {- const out = [...args];- // Find the LAST print flag so the prompt lands as its value even if the argv- // carries stray tokens (it shouldn't, post-ensureAntigravityPrintArgs).- let idx = -1;- for (let i = out.length - 1; i >= 0; i--) {- if (ANTIGRAVITY_PRINT_FLAGS.includes(out[i])) { idx = i; break; }+ let flag = '--print';+ const out = [];+ for (const arg of args) {+ if (ANTIGRAVITY_PRINT_FLAGS.includes(arg)) flag = arg;+ else out.push(arg);}- // No print flag at all → add one. Otherwise lift the existing marker out of- // its current position so it can be re-appended as the final pair.- const flag = idx === -1 ? '--print' : out.splice(idx, 1)[0];out.push(flag, prompt);return { args: out, useStdin: false, cleanup: NOOP_CLEANUP };}diff --git a/server/lib/antigravity.test.js b/server/lib/antigravity.test.jsindex fb40e9b7ba..d9aba077f6 100644--- a/server/lib/antigravity.test.js+++ b/server/lib/antigravity.test.js@@ -206,6 +206,15 @@ describe('prepareAntigravityPrompt', () => {const { args } = prepareAntigravityPrompt(['-p', '--verbose'], 'PROMPT');expect(args).toEqual(['--verbose', '-p', 'PROMPT']);});++ // extraArgs are concatenated on AFTER ensureAntigravityPrintArgs has stripped+ // baked print flags, so they can smuggle a second one in. A leftover flag+ // would make agy read the token after IT as the prompt.+ it('lifts EVERY print flag, not just the last, and the last spelling wins', () => {+ const { args } = prepareAntigravityPrompt(['--print', '--verbose', '-p'], 'PROMPT');+ expect(args).toEqual(['--verbose', '-p', 'PROMPT']);+ expect(args.filter((a) => a === '--print')).toHaveLength(0);+ });});describe('ensureAntigravityTuiArgs', () => {