Skip to content

ui-server: the scripts/brain-cli.ts fallback cannot launch in a masked worker #2865

Closed

Description

@schlessera

Context

Observed while implementing #2699. A brain without a packaged CLI (node_modules/.bin/brain) falls back to ["bun", "scripts/brain-cli.ts"] (export function brainCliCommand, packages/ui-server/src/brain/client.ts:147-151). The masked workers that build a provider-restricted turn's private index and read its taxonomy (runMaskedBrainCli, packages/ui-server/src/brain/private-index.ts:66) pass that argv to the launcher, which refuses any relative executable (if (!isAbsolute(input.brainPath), packages/ui-sdk/src/server/worker-launcher.ts:516-518: "an absolute brain path and worker executable are required").

So on such a brain, every types: provider selector refuses ("the brain's taxonomy could not be read: Agent worker boundary unavailable: an absolute brain path and worker executable are required…"), and the private index build fails (logged as an incomplete index), even when the fallback script is protected by the policy. The failure message reads as a host boundary problem, which it is not. Reproduced by the scripts/brain-cli.ts fallback test added in #2699 (packages/ui-server/tests/private-index.test.ts), which uses a configured absolute command to prove the protected case for that reason.

Scope

Preserve brainCliCommand's existing packaged-CLI preference and script fallback. Make the fallback launchable through the masked worker by resolving its runtime executable to an absolute admitted path; do not weaken the worker launcher's absolute-path requirement. Verify script resolution in the immutable startup view and preserve all provider masks and taxonomy-code protection from #2699. Exact helper placement is an implementation choice.

Out of scope

Acceptance criteria

  • A fictional brain with no packaged CLI and a protected scripts/brain-cli.ts completes masked taxonomy and private-index operations through the real worker boundary; the pre-fix failure is the absolute-executable refusal, not a load error.
  • An unprotected fallback still refuses under ui-server: protect the code a type-translated turn's taxonomy runs #2699, and inaccessible runtime/script paths refuse visibly without host execution or broader mounts.
  • Packaged CLI selection and ordinary host fallback behavior remain unchanged; focused controls cover both.
  • Record failing-first and restored mutation receipts, then run private-index coverage and affected preflight.

Verification

ui-server private-index tests, then bun run check:pr --base origin/main.

Contract impact

None expected.

2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Scoped the concrete mismatch using the existing supported fallback and immutable-worker contract; no new unsupported-layout policy is selected. #2699 supplies the protected-taxonomy path and negative case, so retain an explicit dependency. Source inspection is not an executed real-worker reproduction.

Activity

  1. added
    type: fixSomething is broken and must behave the way it is documented.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Oct 25, 2026
  2. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Scoped the concrete mismatch using the existing supported fallback and immutable-worker contract; no new unsupported-layout policy is selected. #2699 supplies the protected-taxonomy path and negative case, so retain an explicit dependency. Source inspection is not an executed real-worker reproduction.

  3. removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Oct 25, 2026
  4. added this to the 0.45.0 milestone on Oct 25, 2026
  5. self-assigned this
    on Nov 3, 2026
  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claiming (token claim-2865-k7q3), branch fix/2865-masked-brain-cli-fallback from main adf371ffa. Path collisions on cited files: client.ts with #3467 and #3482, worker-launcher.ts with #3408/#3464/#3465 (this change does not plan to edit the launcher). Citations drifted: brainCliCommand is now client.ts:136-140, the launcher refusal worker-launcher.ts:515-517.

  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    2026-11-03: refreshed drifted citations against main e6a417ba6: brainCliCommand is client.ts:147-151, the launcher refusal worker-launcher.ts:516-518; runMaskedBrainCli (private-index.ts:66) is unchanged. No scope change.

  8. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Draft PR #3494 at head 69abbbe7d. Masked workers now run the fallback's bun as the server's own runtime; the script stays relative, inside the startup view. Local failing-first, mutation and check:pr receipts are in the PR. Real-worker tests that need nested user namespaces still need hosted proof. The PR stays a draft until hosted proof and integration; the claim stays with this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: fixSomething is broken and must behave the way it is documented.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions