stdioBridge: the boot bridge payloadDir silently clobbers the shell OURCLOUD_PAYLOAD_DIR override (precedence ruling needed, #491 fallout) #496

Closed
opened 2026-08-13 00:28:26 +00:00 by ben · 5 comments
Owner

The trap (found via drive 20260812T213049Z, the first phase-2 red): app/src/lib/stdioBridge.ts:80 — if (launch.payloadDir) env.OURCLOUD_PAYLOAD_DIR = launch.payloadDir; assigns the boot bridge's value OVER the inherited shell env ({ ...nodeProcess.env } spread comes first), even though the constructor comment right above states the intent that "the dev overrides … ride through from the shell's launch environment". Pre-#491 the preload dropped payloadDir, so the guard never fired and shell overrides worked by accident; post-#491 (ae5fa36) the bridge always carries resourcesPath/payload on a non-dev launch, so a shell OURCLOUD_PAYLOAD_DIR is now silently dead. The rehearsal drive hit this (supply-leg scp from a nonexistent resources/payload) and the healer worked around it harness-side (a3b4c61: symlink staging in smoke-private-path.sh) — so nothing is broken TODAY.

The open ruling (why this is ready-for-human, one decision): should a shell OURCLOUD_PAYLOAD_DIR beat the carried payload?

  • Env wins (if (launch.payloadDir && !env.OURCLOUD_PAYLOAD_DIR) …): matches the comment's stated intent and the rehearsal runbook's documented knob; risk — a stray env var in an operator's shell silently redirects a packaged install's payload.
  • Bridge wins (status quo): packaged installs are immune to ambient env; risk — the documented override contract is dead code and the comment lies; harnesses must keep staging symlinks.

Either way the loser should be made explicit: fix the comment or fix the precedence, plus a unit test pinning whichever precedence is ruled.

**The trap (found via drive `20260812T213049Z`, the first phase-2 red):** `app/src/lib/stdioBridge.ts:80` — `if (launch.payloadDir) env.OURCLOUD_PAYLOAD_DIR = launch.payloadDir;` assigns the boot bridge's value OVER the inherited shell env (`{ ...nodeProcess.env }` spread comes first), even though the constructor comment right above states the intent that "the dev overrides … ride through from the shell's launch environment". Pre-#491 the preload dropped `payloadDir`, so the guard never fired and shell overrides worked by accident; post-#491 (`ae5fa36`) the bridge always carries `resourcesPath/payload` on a non-dev launch, so a shell `OURCLOUD_PAYLOAD_DIR` is now silently dead. The rehearsal drive hit this (supply-leg scp from a nonexistent `resources/payload`) and the healer worked around it harness-side (`a3b4c61`: symlink staging in smoke-private-path.sh) — so nothing is broken TODAY. **The open ruling (why this is ready-for-human, one decision):** should a shell `OURCLOUD_PAYLOAD_DIR` beat the carried payload? - **Env wins** (`if (launch.payloadDir && !env.OURCLOUD_PAYLOAD_DIR) …`): matches the comment's stated intent and the rehearsal runbook's documented knob; risk — a stray env var in an operator's shell silently redirects a packaged install's payload. - **Bridge wins (status quo):** packaged installs are immune to ambient env; risk — the documented override contract is dead code and the comment lies; harnesses must keep staging symlinks. Either way the loser should be made explicit: fix the comment or fix the precedence, plus a unit test pinning whichever precedence is ruled.
Author
Owner

Ben's ruling 2026-08-13: ENV WINS. A shell OURCLOUD_PAYLOAD_DIR beats the bridge-carried payloadDir — the constructor comment's stated intent and the rehearsal runbook's documented knob become true again.

The fix:

  • app/src/lib/stdioBridge.ts:80 → if (launch.payloadDir && !env.OURCLOUD_PAYLOAD_DIR) env.OURCLOUD_PAYLOAD_DIR = launch.payloadDir;
  • A unit test pinning the precedence BOTH ways: env set → env value survives; env clean → bridge value lands (the packaged-install default).
  • The accepted risk is on the record: a stray OURCLOUD_PAYLOAD_DIR in an operator's shell redirects a packaged install's payload — dev-shaped variable, rare in the wild.
  • Follow-through: the healer's harness-side symlink staging (a3b4c61, smoke-private-path.sh) exists only to work around this precedence; once env-wins lands and a drive proves green, that staging can retire.

Flipping to ready-for-agent.

**Ben's ruling 2026-08-13: ENV WINS.** A shell `OURCLOUD_PAYLOAD_DIR` beats the bridge-carried payloadDir — the constructor comment's stated intent and the rehearsal runbook's documented knob become true again. The fix: - `app/src/lib/stdioBridge.ts:80` → `if (launch.payloadDir && !env.OURCLOUD_PAYLOAD_DIR) env.OURCLOUD_PAYLOAD_DIR = launch.payloadDir;` - A unit test pinning the precedence BOTH ways: env set → env value survives; env clean → bridge value lands (the packaged-install default). - The accepted risk is on the record: a stray `OURCLOUD_PAYLOAD_DIR` in an operator's shell redirects a packaged install's payload — dev-shaped variable, rare in the wild. - Follow-through: the healer's harness-side symlink staging (`a3b4c61`, smoke-private-path.sh) exists only to work around this precedence; once env-wins lands and a drive proves green, that staging can retire. Flipping to ready-for-agent.
Author
Owner

swarm-claim host=matou-dev-server-01 run=5512
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=5512 (automated multi-host claim — lowest live claim id works this ticket)
Author
Owner

swarm-claim host=elitebook-distributed-server-03 run=5495
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=5495 (automated multi-host claim — lowest live claim id works this ticket)
Author
Owner

close-report for #496 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit df76c60bee is not reachable from origin/main (not landed on main)
  • changed_files: 'app/src/lib/stdioBridge.ts' is not in the diff of the claimed commits
  • changed_files: 'app/tests/unit/stdioBridge.test.ts' is not in the diff of the claimed commits
envelope
{
  "issue": 496,
  "status": "success",
  "commits": [
    "df76c60bee60713fe126311377c4f923a6c957ee"
  ],
  "changed_files": [
    "app/src/lib/stdioBridge.ts",
    "app/tests/unit/stdioBridge.test.ts"
  ],
  "tests": [
    {
      "command": "npx vitest run tests/unit/stdioBridge.test.ts",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json --noEmit",
      "exit_code": 0
    }
  ],
  "criteria": {
    "ENV WINS: shell OURCLOUD_PAYLOAD_DIR beats bridge-carried payloadDir": "app/src/lib/stdioBridge.ts guard changed to ; test 'lets a shell OURCLOUD_PAYLOAD_DIR win over the carried payloadDir' passes",
    "loser made explicit (comment fixed to state precedence)": "app/src/lib/stdioBridge.ts constructor comment now states 'a shell OURCLOUD_PAYLOAD_DIR WINS ... (Ben's ruling 2026-08-13, #496)'",
    "unit test pinning precedence both ways": "test asserts env-set -> shell value survives AND env-clean -> carried value lands; verified red under old precedence then green"
  },
  "summary": "The boot bridge no longer clobbers an inherited shell OURCLOUD_PAYLOAD_DIR — env wins over the carried payload, per Ben's ruling, with a both-ways precedence test.",
  "blockers": []
}
**close-report** for #496 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit df76c60bee60713fe126311377c4f923a6c957ee is not reachable from origin/main (not landed on main) - changed_files: 'app/src/lib/stdioBridge.ts' is not in the diff of the claimed commits - changed_files: 'app/tests/unit/stdioBridge.test.ts' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 496, "status": "success", "commits": [ "df76c60bee60713fe126311377c4f923a6c957ee" ], "changed_files": [ "app/src/lib/stdioBridge.ts", "app/tests/unit/stdioBridge.test.ts" ], "tests": [ { "command": "npx vitest run tests/unit/stdioBridge.test.ts", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json --noEmit", "exit_code": 0 } ], "criteria": { "ENV WINS: shell OURCLOUD_PAYLOAD_DIR beats bridge-carried payloadDir": "app/src/lib/stdioBridge.ts guard changed to ; test 'lets a shell OURCLOUD_PAYLOAD_DIR win over the carried payloadDir' passes", "loser made explicit (comment fixed to state precedence)": "app/src/lib/stdioBridge.ts constructor comment now states 'a shell OURCLOUD_PAYLOAD_DIR WINS ... (Ben's ruling 2026-08-13, #496)'", "unit test pinning precedence both ways": "test asserts env-set -> shell value survives AND env-clean -> carried value lands; verified red under old precedence then green" }, "summary": "The boot bridge no longer clobbers an inherited shell OURCLOUD_PAYLOAD_DIR — env wins over the carried payload, per Ben's ruling, with a both-ways precedence test.", "blockers": [] } ``` </details>
Author
Owner

close-report for #496 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 496,
  "status": "success",
  "commits": [
    "df76c60bee60713fe126311377c4f923a6c957ee"
  ],
  "changed_files": [
    "app/src/lib/stdioBridge.ts",
    "app/tests/unit/stdioBridge.test.ts"
  ],
  "tests": [
    {
      "command": "npx vitest run tests/unit/stdioBridge.test.ts",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json --noEmit",
      "exit_code": 0
    }
  ],
  "criteria": {
    "ENV WINS: shell OURCLOUD_PAYLOAD_DIR beats bridge-carried payloadDir": "stdioBridge.ts guard changed to 'if (launch.payloadDir && !env.OURCLOUD_PAYLOAD_DIR)'; test 'lets a shell OURCLOUD_PAYLOAD_DIR win over the carried payloadDir' passes",
    "loser made explicit (comment fixed to state precedence)": "stdioBridge.ts constructor comment now states a shell OURCLOUD_PAYLOAD_DIR WINS over the carried payloadDir (Ben's ruling 2026-08-13, #496)",
    "unit test pinning precedence both ways": "test asserts env-set -> shell value survives AND env-clean -> carried value lands; verified red under old precedence then green after fix"
  },
  "summary": "The boot bridge no longer clobbers an inherited shell OURCLOUD_PAYLOAD_DIR — env wins over the carried payload per Ben's ruling, with a both-ways precedence test.",
  "blockers": []
}
**close-report** for #496 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 496, "status": "success", "commits": [ "df76c60bee60713fe126311377c4f923a6c957ee" ], "changed_files": [ "app/src/lib/stdioBridge.ts", "app/tests/unit/stdioBridge.test.ts" ], "tests": [ { "command": "npx vitest run tests/unit/stdioBridge.test.ts", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json --noEmit", "exit_code": 0 } ], "criteria": { "ENV WINS: shell OURCLOUD_PAYLOAD_DIR beats bridge-carried payloadDir": "stdioBridge.ts guard changed to 'if (launch.payloadDir && !env.OURCLOUD_PAYLOAD_DIR)'; test 'lets a shell OURCLOUD_PAYLOAD_DIR win over the carried payloadDir' passes", "loser made explicit (comment fixed to state precedence)": "stdioBridge.ts constructor comment now states a shell OURCLOUD_PAYLOAD_DIR WINS over the carried payloadDir (Ben's ruling 2026-08-13, #496)", "unit test pinning precedence both ways": "test asserts env-set -> shell value survives AND env-clean -> carried value lands; verified red under old precedence then green after fix" }, "summary": "The boot bridge no longer clobbers an inherited shell OURCLOUD_PAYLOAD_DIR — env wins over the carried payload per Ben's ruling, with a both-ways precedence test.", "blockers": [] } ``` </details>
ben closed this issue 2026-08-13 03:22:04 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#496
No description provided.