Skip to content

Linux engine: report "nothing of the input was posted" so a failed secret can say "nothing was entered" #604

Done

Description

@SSFSKIM

What it's for

When a request carrying a secret ({{secret:KEY}}, substituted by trusted code) fails, cua's secret wrapper (src/services/secret-input.mjs, called from src/services/sky.mjs) withholds the engine's own message, which could contain the secret, and tells the model one of two things:

  • "nothing was entered": the model may observe the app and retry;
  • "it may have been partly entered": the model must not observe the app or type it again, and asks the person to check (ruling 1247(d)).

Under ruling 1260 the first answer needs the engine's positive record that none of the input went out. The macOS engine sends that record from #602 on. cua's Linux engine sends none, so every failed secret on Linux answers "may have been partly entered". That is safe but imprecise: a refusal that typed nothing reads the same as a failure halfway through.

The contract

Field. beforeInput, a boolean. It is sent as true only when set and omitted otherwise. It is never false on the wire and never a count: a count would tell the secret's length.

Where it rides. On the failure's input metadata, beside the error name. On macOS that is the JSON-RPC error's meta object (InputMeta), which the Node client carries as error.meta on a SkyComputerUseError, and the wrapper reads error.meta.beforeInput === true (secretUnentered). cua's Linux engine answers {ok: false, error: "<sentence>"} today, and its client (src/services/engine/linux/client.mjs ~L118–121) turns that into a plain Error with no meta. So the Linux work has three parts:

  1. The engine's failure answer gains a metadata object carrying beforeInput, for example {ok: false, error, errorName, meta: {beforeInput: true}}.
  2. The Linux client carries it into an error the wrapper reads the same way as macOS's: the same error.name and error.meta shape, or the wrapper's check widened to the Linux error. Pick one and keep the wrapper's single predicate.
  3. A test that a Linux failure with the record answers "nothing entered", and without it "may have been partly entered".

When it may be set: only when the engine knows that none of the request's input went out.

  • No key event of the text (no XTest or uinput key, no xdotool type).
  • No paste: no Ctrl+V or Shift+Insert, no middle-click paste, no Return or Tab of a multi-line or multi-unit entry.
  • No value write: no AT-SPI EditableText set or insert.
  • No clipboard or selection-ownership change that a later paste could use.

What may have happened when it's set: anything that isn't input. Resolving the target, reading AT-SPI, a scroll, raising or activating the window, a focus click, a modifier check, the clipboard snapshot (a read).

When it must not be set:

  • after the first key, paste or value write, even if that one event failed partway;
  • when the engine can't tell, for example an error that comes back from a helper process with no report of what it posted;
  • on any error raised from a path the engine doesn't track. An untracked path errs toward "may have been entered".

How macOS sets it (for reference, not to copy). A method marks a stage flag just before its input stretch starts. Its catch adds beforeInput only while that flag is still unset. Lower functions (the key loop, the paste route, the value write) mark their own pre-post throws. Every refusal before any input therefore carries it, and every path not covered falls back to the cautious answer.

Interventions. If the Linux engine reports that the user intervened, with an account of the phase and effects, the record can ride beside that account. The wrapper then also requires that the account's effects, when present, name neither input nor value.

Done when

The Linux engine sends beforeInput: true on every failure that posted none of its input, and on no other. The Linux client delivers it to the secret wrapper. Tests cover both answers, and the 1247(d) sweep includes a Linux failure without the record.

Board

Enhancement, P2. Parent #114. Relates to #602.

Sminos-Session: cursor235#b93055dd (cua on macbook)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:P3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions