Repository navigation
test: guard the host X display socket during test runs - #237
Merged
Merged
Conversation
Add a static check that rejects bare Xvfb -displayfd and xvfb-run -d, and a vitest global setup that fails the run when the host DISPLAY socket changes. Refs #234.
Watch /tmp/.X11-unix during the run so a socket that is created and removed, or moved away and back, fails the run. Read DISPLAY numbers with leading zeros as Xlib does. Warn and stay inactive when setup cannot read the socket, and fail the run when teardown cannot. Bound the security scan to one command or argument list. Check -displayfd for an exact display token, follow xvfb-run across lines and shell continuations, and parse grouped short options.
Replace the ad hoc boundary and token logic in the display scan with one quote-aware lexer for both rules. Terminators and the closing array bracket count only outside quotes, comments are dropped, and a bare shell word absorbs adjacent quoted parts. A display now counts only as the first argument or after a token that is not an option. Unquoted array items such as spreads count as xvfb-run options, so only a quoted string ends the option list.
3 tasks done
Lex command by command on the logical line when the X server name is not on the same command, so wrapper and variable forms keep earlier display arguments. Use array context only inside an unclosed bracket, and treat // and block comments as comments only in JS context.
2 tasks done
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.
Tests and QA started X servers that replaced the host display socket
/tmp/.X11-unix/X0, which broke every new X11 app on the host. This adds a static check that rejects the unsafe Xvfb forms, a vitest guard that fails a local run when the hostDISPLAYsocket changes, and an AGENTS.md rule. Product code is unchanged. The guard does nothing whenDISPLAYis unset, as in CI.Closes #234
-displayfdandxvfb-run -dspawn("Xvfb", [...]), shellXvfb -displayfd,xvfb-run -d,--auto-display,-ad,-dafter an-svalue. Allowed: explicit:N, template:${...},xvfb-run -a,-dafter the command or after-n 99. A bad file planted intest/fails the scan; removing it passes~/.cache/kickoff-234/qa/scan-bad.log,scan-clean.log:64998DISPLAY=:64998.0: exit 0. Vitest only logs teardown errors, so the guard also sets the exit code~/.cache/kickoff-234/qa/guard-*.logDISPLAYlocalhost:0,wayland-1, malformed valuestest/host-display-guard.test.tsAGENTS.mddiffviewer-cursor.test.tscleanupallocateDisplayand SIGTERMPICKFORGE_REQUIRE_*flags, default/tmp, and the guard armed on the realDISPLAY=:0: 2418 passed, 0 failed, host socket inode unchanged. One earlier run hit an unrelated allocation flake under load, filed as #240. CI fully green at a5b94bd, including gitleaks after #241 fixed #236~/.cache/kickoff-234/test-final2.log,pickcheck.jsonQA pass, evidence in
~/.cache/kickoff-234/qa/. Incident replay in a private namespace with a path-onlyX0listener and a live lock: a test that starts a real bareXvfb -displayfd 3makes vitest exit 1 with the guard message, andX0really was replaced; the explicit:1234form exits 0. The scan flags the bare form ofviewer-cursor.test.tsas it ran on 2026-10-03 (line 269) and passes its explicit and current forms. A real Pickforge desktop session (session create,desktop exec zenity,windows,key,screenshot,session destroy) ran on:91and left the hostX0inode unchanged. Review: Astra and Fable at xhigh, three repair rounds, final rechecks report nothing blocking.