Repository navigation
#598: launch_app on Linux answers when gio exits, with the launched app's output on /dev/null - #605
Merged
Merged
Conversation
…ed app closes its output `gio launch` hands the application its own stdin, stdout and stderr. runGioLaunch gave gio execFile's pipes, the application kept them open, and the answer came only at the 30 s timeout (after which the application's next write met a closed pipe). gio now gets /dev/null for stdin and stdout and, for stderr, a private file unlinked before it starts; the launch settles on gio's exit and reads gio's last line back from that file only when gio failed, so every answer and error sentence stays as it was (a silent failure's no longer ends in a newline). A fake gio whose application writes to its output forever: 30,005 ms before, 10 ms after, the application alive with none of its fds a pipe or socket. Live, real gio and xterm -e 'sleep 600' on a private Xvfb: 30,047 ms before, 14 ms after. Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… entry's own failures are named first Review of b7fd6bb: the stderr capture file brought problems of its own. It was opened by path twice in the supervisor's TMPDIR, the session temp a scoped cell may write, so a swap between the opens could hand back bytes the cell cannot read. The app kept writing into the deleted file for its whole life. And its read-back ran in an event callback, where a read error exited Node. gio now gets /dev/null for stdin, stdout and stderr, as the engine's own launch_app gives its application, so the app inherits no pipe and no file. A failure is answered with how gio ended: "gio launch <path> exited with status N", "was ended by <signal>", or "did not finish within N ms". Real gio ends 1 on every failure (probed: a missing program, a malformed entry, no Exec field, a Link entry, an unreadable entry, a missing one). Before gio runs, launchLinux names the usual failures for an entry where launch_app looks: "refused to launch <path>: it does not exist" and "it cannot be read (EACCES)". An entry elsewhere keeps the generic refusal, which does not say whether it exists. The fake gio's tests take their pid paths as quoted shell data ("$here", from "$0") and stop every recorded process whatever the test did. A run with a TMPDIR containing a space passes and leaves nothing behind. Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…nals only its own processes Re-review of b24375d. Wave 1's pre-check judged a missing entry by its spelled path, while the ordinary refusal judges the resolved one. A symlink under an XDG applications directory therefore answered "it does not exist" when its target outside the roots was missing, and the generic refusal when the target existed, which reveals the target's existence. It also read EACCES on a directory as missing. launch_app only launches ids that list_apps parsed, and gio ends 1 on every failure, so the pre-check is dropped: launchLinux is main's again. An absent entry gets main's generic refusal, "refused to launch <path>: only a desktop entry in an XDG applications directory is launched". runGioLaunch keeps /dev/null for all three streams, and keeps the exit-status, signal and timeout sentences. The fake gio's cleanup read every *.pid record as a number. An empty or partial record from a fake that died mid-write became 0, and kill(0) would stop the runner's own process group. It now signals only a record that is a positive pid, is neither the runner nor its parent, and whose command line names the fake's directory (ps -ww -o command=, on Linux and macOS alike). The fake's processes carry that directory in their argv. Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… keeps the argv that names them On hosted macOS (ci-gate test-2, run 46098090043) the cleanup test's genuine record went unsignalled. /bin/sh there is bash, which execs a lone `sleep 30` in place of the shell, so the process's command line no longer named the fake's directory. A loop keeps the shell, and its argv, in place. Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
The coordinator allocates the final number at merge. Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
SSFSKIM
enabled auto-merge (squash)
November 28, 2026 03:03
SSFSKIM
added a commit
that referenced
this pull request
Nov 28, 2026
Sminos-Session: cursor235#b93055dd (cua on macbook)
SSFSKIM
added a commit
that referenced
this pull request
Nov 28, 2026
Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
SSFSKIM
added a commit
that referenced
this pull request
Nov 28, 2026
…587), and a failed read-back read is retried and diagnosed (#590) (#601) * macOS engine 0.2.2: type_text with no field to read back answers ok with a note; a failed read is read again (refs #587) #587 (ruling 1219): a focused element that is not a text field (Finder's type-select in a list or outline) threw typeUnconfirmed (notTextField) after its keys landed; the vendor answers ok. Both routes now answer success with a note that the text could not be read back and the app should be observed before relying on it or typing it again; the record keeps confirmed: false and the reason. noFocusedElement takes the same contract: the vendor's targetForKeyboardEvent answers the app's pid when focusedUIElement is nil, with no error, and posts without reading the element (F §5.7, the pinned helper's 0x1006f645c). A text field's read-back, the password reasons and selectionChanged are unchanged. #590 (ruling 1225): a role, value or range read at the snapshot (settle and wait included), and a role or subrole read in a poll, that answers nothing is read again up to 2 times, 15 ms apart, while its phase has time (the request's time left less one messaging timeout; the poll's budget). Only a failed read is retried; a mismatch never becomes ok. On an unreadable reason the record carries readFailure {phase, read, axError, retries, msSinceLastKey, role, subrole}, never a value; concealed and password records drop the counts and time. Sminos-Session: cursor235#b93055dd (cua on macbook) * service: the no-field note reaches the tool result's text, and readFailure rides as cua/typeReadback (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * Own native engine spec and tech debt: #587 and #590's Decision Log entry, the record's readFailure, the unretried focus check (refs #590) Sminos-Session: cursor235#b93055dd (cua on macbook) * Plugin 0.29.23: type_text with no field to read back answers ok, and failed reads are retried (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * macOS engine: ok-with-note only for a literal request whose search finished with no field; a retry never reads past its first try (refs #587) Ruling 1244 on the review of e54eab4..106d201, with ruling 1242's narrowing. - P1-1: a concealed request with no field stays typeUnconfirmed and its remedy never advises a screenshot or getAXState(), whatever the search found. - P1-2: the lookup has three outcomes: a field, .noField (the walk finished with none, and the marker route, when it ran, reached the web area), or nil, indeterminate, which throws as before. The walk answers ReadbackWalkOutcome; the app's own answer of no focus is never enough (background Safari answers so over a focused field). - P1-3: a value or range retry, in the snapshot and its settle, runs only after the role and subrole are read again and still classify the field. - P1-4: a poll's role read naming AXSecureTextField or another role ends the check whatever its subrole read answers. - P2-5: a field the lookup took for a password field is classified by one role read, never retried. - P2-6: no field under select_text's range is selectionChanged, nothing typed or pasted. - P2-7: the keyed route's retries and polls are bounded by the request's deadline. - P2-8: readFailure keeps the role and subrole last read successfully. Sminos-Session: cursor235#b93055dd (cua on macbook) * service: the no-field note's comment follows ruling 1242 (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * Own native engine spec: rulings 1242 and 1244, the three-way lookup, the invariants and the record (refs #590) Sminos-Session: cursor235#b93055dd (cua on macbook) * Plugin 0.30.1: type_text with no field to read back answers ok, and failed reads are retried (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * macOS engine: ok-with-note is notTextField alone; noFocusedElement throws as before; a secret's answers never advise observing (refs #587) Ruling 1247 on the review of 106d201..d51ae68. - noFocusedElement throws typeUnconfirmed exactly as before #587 (a declared limit): .noField, the marker's .noField and ReadbackWalkOutcome are removed, the walk and marker route answer as before except as below. - c: a field the walk or marker found by a text-entry role (ReadbackFound.field's role) that the snapshot reads as another role answers fieldChanged, never notTextField. - b: a password field the marker classified but whose focus or place under the web area it cannot show closes as a password field's (fieldUnreadable, secure), whatever the walk finds. - d: a concealed request's typeUnconfirmed, every reason, ends with a remedy that names no observation (readbackConcealedRemedy, or readbackConcealedMayShowRemedy). - e: under select_text's range the nil lookup (and a closed password claim) answers selectionChanged before any key or ⌘V. - h: after a retry's re-classification, the retried read starts only while the bound allows. Sminos-Session: cursor235#b93055dd (cua on macbook) * secret wrapper: no answer after a secret's first key advises observing the app (refs #587) Ruling 1247 (d). secretMayShow classifies 'passwordField' (as before) or 'unplaced' (notTextField, noFocusedElement, fieldChanged and every other reason posted without confirmation); every sky failure that may have entered part of the secret carries a warning of that kind, worded without a screenshot or getAXState; a userChanged intervention once entered asks the user to check where it went instead of re-querying. The test runs every branch after the first key. Sminos-Session: cursor235#b93055dd (cua on macbook) * Own native engine spec: ruling 1247, notTextField alone, noFocusedElement a declared limit, the secret rule (refs #590) Sminos-Session: cursor235#b93055dd (cua on macbook) * macOS engine: a found field is held to its role first, and select_text's range comes before it (refs #587) Ruling 1249 on the review of ef383ad..75481fd. - (1) The role the walk or the marker route found a field by is compared with the snapshot's before anything else is read: a password field's role or subrole answers becameSecure, any other difference fieldChanged; no value, range or length is read. A field the lookup took for a password field keeps its own check (noLongerSecure); the application's focus is not compared. - (2) Under a pending select_text range, any outcome that cannot hold it (a changed role, a non-text or secure non-field element, the nil lookup, a closed claim) answers selectionChanged before any key or ⌘V. Sminos-Session: cursor235#b93055dd (cua on macbook) * tech-debt: the native engine's input-source and intervention errors still advise get_app_state after a secret's first key (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * macOS engine: one classification identity, one comparison, one selection gate (refs #587) Ruling 1250 on the review of 75481fd..c96a7cc, replacing the case-by-case guards. - R1: a field's classification is ReadbackIdentity (role, subrole if read, open|secure). The lookup's is the baseline when it classified the field (the walk's role, the marker's role and subrole), else the snapshot's first read. Every later classification (the snapshot's first read, #359's wait, the settle, poll and checkpoint, every retry's re-classification, each length batch) goes through readbackClassify alone; any difference ends the read-back: becameSecure, noLongerSecure, else fieldChanged. Only components the baseline read are compared; the walk's first subrole is adopted. - R2: under a pending select_text range, readbackSnapshot lets only a verified-range .expect through; every other answer is selectionChanged there, before any key or ⌘V. - Deleted: wave 3's already-classified skip and foundRole comparison, the per-path selection checks of waves 2 and 3, fieldClosed's own role branches, readbackFieldClosed, readbackLength's own classification checks, and ReadbackFound.field's password and role (now identity). - The proof: a table of 16 classification points x their transitions x selection pending (196 keyed runs; 49 on the paste route), asserting outcome, keys and ⌘V; round 4's three cases by name. Sminos-Session: cursor235#b93055dd (cua on macbook) * macOS engine: the walk's focus check after the poll is classified by R1; AXGroup's unread subrole is open at the final batch (refs #587) Ruling 1254 on the review of c96a7cc..4b07ce0. - P1-1: stillFocused now answers ReadbackRefocus, the focus and the role the walk read of the field it found again; that role goes through readbackClassify (a role-only reading), so a field that turned AXSecureTextField or another role between the last value read and the check ends the read-back, and a checkpointed Return is not posted. Two table rows. - P2-2: the concealed final batch's failed-subrole exception applies only where the role leaves security open: not AXSecureTextField, not neverSecureRoles (#525). AXGroup with an unread subrole answers noLongerSecure again; AXGroup still secure by a read subrole, fieldChanged. Sminos-Session: cursor235#b93055dd (cua on macbook) * tech-debt: a walk-claimed open field whose first subrole read fails goes down the length path (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * plugin 0.30.2: #599 took 0.30.1 (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook) * plugin 0.30.3: #605 took 0.30.2 (refs #587) Sminos-Session: cursor235#b93055dd (cua on macbook)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux,
launch_apptook about 30 s to return when the launched app kept its standard output open. It now returns as soon asgio launchexits.runGioLaunch(src/repl-host/launch-services.mjs) rangio launchthroughexecFile, which gave gio pipes and settled when they closed. The app gio starts inherits those pipes and holds them, so the call settled only atexecFile's own 30 s timeout, long after the window was up./dev/nullfor all three streams, as the Rust engine's ownlaunch_appalready does, and the call answers on gio's exit. The launched app inherits no pipe and no file. This also removes an older hazard on main: once cua's end of a pipe closed under a running app, the app's next stderr write raised SIGPIPE.failed to launch the application:prefix. gio's own error text is no longer captured. A probe of real gio found it exits 1 on every failure, and only two failure modes carried useful text: a malformed entry, and one with no Exec line.launch_apponly launches ids thatlist_appsreturned from entries it parsed, so neither reaches it in practice.Closes #598
Validation Evidence
giowhose child holds its stdout and stderr open forever returned at 30,005 ms. At the head it returns in 7 to 10 ms against a 2 s bound. The app's fds 0, 1 and 2 read/dev/nullthrough/proc, and the session temp directory is left empty. TMPDIR contains a space./usr/bin/gioon a private Xvfb display and a temporary home, launchingxterm -e "sleep 600": 30,081 ms on main (with the xterm's stdout and stderr on cua's sockets), 13 ms at the fix (all three on/dev/null).test/repl-host/linux-launch.test.mjs): 8 of 8. They include the cleanup guard, which signals only positive, owned PID records. It was red first against an injected recordingkill, which showed the old cleanup signalling 0, -1, NaN and the runner's own PID.test/services-engine-linux/, thetest/services-sky*files,test/repl-host/andtest/runtime-linux-launch.test.mjs: 361 tests, 0 fail.npm testagainst main (ruling 743): 53 fail, none outside main's own set.ci-gate --gates test-1,test-2,pluginat 522d435: GREEN, https://github.com/SSFSKIM/cua/actions/runs/46099827912. The head adds a merge of main (10ee501) and the version bump; the PR's own CI runs at the head.Residue
test/linux-engine-diff/ancestry-watch.test.mjsL86 is flaky: a race between two watcher sentences. It failed once in test-1 at 96f11f4 and passed on every other run. This branch doesn't touch it, so it's worth a tracker line or a ticket.Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)