Skip to content

Facade: a rejected computer setup leaves bootstrap pending forever (the sky proxy answers 'then') #236

Closed

Description

@SSFSKIM

Problem

If the computer surface's setup is rejected, the facade's bootstrap never settles. The session's start hangs, and Node reports an unhandled rejection. The agent never gets the setup error. A broken install, a missing service or a failed trusted RPC should produce one clear error; instead the session start hangs.

Found by #171 M3.2's task review (session linux171) while making the Linux service's setup always resolve. Linux no longer reaches it (M3.2's setup resolves and refuses per method). macOS still does.

Cause

src/cua-api/sky.mjs:27-33: the sky proxy's get answers every member that is not on the client with () => Promise.reject(setupError) once setupError is set, and that includes then. src/cua-api/create-tinysky-alt.mjs:100-103: async function loadComputer returns sky. Resolving an async function's promise with a value that has a then function calls then(resolve, reject). The synthetic then ignores both arguments and returns a rejected promise, so the outer promise never settles, and the rejection it returns is unhandled. The vendor's sky.js has the same code.

On macOS, the engine service's own setup is synchronous and does no I/O, so it cannot throw. The defect is reached when the wrapper fails at setup: CUA_SKY_SERVICE unset, its module failing to import, or the trusted RPC failing at setup.

Reproduction

Script outside the repository (~/.local/share/cua-171/repro/sky-then-hang.mjs on the MacBook):

globalThis.nodeRepl = {rpc: async () => { throw new Error('setup refused (repro)'); }};
const unhandled = [];
process.on('unhandledRejection', (e) => unhandled.push(String(e?.message ?? e)));
const {sky} = await import(process.argv[2] + '/src/cua-api/sky.mjs');
let state = 'pending';
(async () => sky)().then(() => { state = 'resolved'; }, (e) => { state = 'rejected: ' + e.message; });
setTimeout(() => { console.log(JSON.stringify({after_ms: 1000, state, unhandled})); process.exit(0); }, 1000);

node sky-then-hang.mjs <checkout> on main (2026-10-31) prints {"after_ms":1000,"state":"pending","unhandled":["setup refused (repro)"]}. linux171's version through the full facade bootstrap on the #171 VM prints {"after_ms":1000,"bootstrap":"pending","unhandled":["setup refused (mac)"]}.

Fix

The proxy must not be thenable: get returns undefined for then (and the descriptor and has traps agree), so a rejected setup rejects bootstrap with its own sentence. This is a deliberate difference from the vendor's facade: declare it where the facade's vendor differential lists differences.

Acceptance

  • A rejected setup makes bootstrap reject within one turn with the setup error's message, with no unhandled rejection: a facade test with a rejecting nodeRepl.rpc, and the full-bootstrap path.
  • A resolved setup behaves as today (the existing facade suites pass unchanged).
  • The vendor differential records the difference as declared.

Activity

  1. added
    bug
    status:ready-for-implementer
    priority:P2
    status:in-progress
    and removed
    status:ready-for-implementer
    on Oct 31, 2026
  2. added 2 commits that reference this issue on Nov 1, 2026
    9508197
    c57d2ee
  3. added
    status:in-review
    and removed
    status:in-progress
    on Nov 1, 2026
  4. removed
    status:in-review
    on Nov 1, 2026
  5. SSFSKIM commented on Nov 1, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Merged in #241 (de827b4), main tree = the gated head tree; plugin 0.20.1

  6. added a commit that references this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions