docs/design/cua-node-repl-reliability-round2.md
This change implements only the ten agreed items below. Every implementation iteration must check its diff against this list before continuing.
globalThis versus lexical bindings, dynamic
import, selective output, and cell/reset lifecycle.forceFull is a one-shot resync path and is never a persistent helper
default.After each fix:
The following evidence is complete for the current implementation. It does not replace the release or benchmark gates below.
ComputerUse client, sentinel, or revision
cursor. The cancelled cell committed no new binding and emitted no late
result.#32770 modal returned a screenshot,
exact HWND/owner metadata, and explicit partial/degraded coverage after
4.35 seconds. Closing the modal rebuilt the worker and the next main-window
observation returned a complete 37-element tree. The Windows release test
suite passed 170 platform tests and 3 UIAccess authorization/pipe tests.committed: false, then completed foreground text input,
two-sample stable verification, and a full-to-diff revision sequence.claude-opus-4-8 contained the 1,078-character Node REPL instruction
exactly once in the MCP-instruction message and the 5,690-character Computer
Use body exactly once when /computer-use was loaded. Both matched the
clean-packed artifacts byte for byte; forceFull appears once, and neither
text contains benchmark, evaluator, score, historical-case, or
application-specific guidance. Qwen Code's focused request-assembly tests
verify that progressively discovered MCP instructions are queued for the
next user turn instead of being lost after the startup prelude is built.The Computer Use skill keeps the original operating principles but maps them to the public CUA SDK instead of copying interfaces from another runtime.
| Principle | Round 2 owner and expression |
|---|---|
| Prefer a connector or API | Computer Use skill, before any UI action |
| Keep one persistent session | Node REPL MCP owns kernel lifecycle; the skill creates one ComputerUse client |
| Select the real app and surface | listApps, then listWindows; no guessed PID, window, token, or coordinate |
| Observe before acting | observeWindow on the exact current surface |
| Prefer semantic targets | Current element tokens before screenshot coordinates |
| Consume incremental state | Per-surface baseRevisionId; one-shot forceFull only for an explicit lineage failure |
| Inspect only useful visuals | Request screenshots when accessibility is incomplete or visual evidence is necessary |
| Use only advertised secondary actions | performSecondaryAction only from the current element action list |
| Re-observe after an unexpected transition | Refresh surfaces and state instead of repeating an action blindly |
| Do not assume text replacement | Inspect current state and select existing text when replacement is required |
| Verify every mutation | Read the typed action result, then require fresh stable state with actAndVerify, verifyState, or a fresh visual observation |
| Stop when the requested state is proven | No extra cleanup actions after the stable postcondition |
The Node REPL MCP instruction exclusively owns JavaScript cell scope, redeclaration, cancellation, output, and reset behavior. The Computer Use skill exclusively owns UI observation, action, result interpretation, and verification. Neither text contains benchmark policy, evaluator criteria, historical failures, or application-specific examples.
The functional change, generated bindings, package metadata, native release metadata, and every required version bump must be complete in the same feature PR. No PR is created until the user explicitly authorizes that exact PR. No post-merge recovery/version PR is assumed.