Skip to content

fix(setup): reject nonregular client configuration before reading - #1379

Closed
rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/client-config-regular-file-20261009
Closed

rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/client-config-regular-file-20261009

Conversation

@rudycelekli

Copy link
Copy Markdown

Problem

A client configuration path can be a FIFO, or a symlink to one. doctor, setup and uninstall open it with ordinary readFile and wait indefinitely for a writer. The command never reaches its diagnostic or planned-action result.

Change

Use the existing regular-file admission/read primitive for all client configuration reads, including maintenance rereads and setup readback. It opens nonblocking, validates the same descriptor and closes it after reading. Project nonregular configuration into actionable client diagnostics. Preserve missing-file creation, ordinary files, owned symlink lifecycle, backups and disabled registrations.

Verification

  • Exact current main a9f5dad compiled runtime: actual writer-free mkfifo inputs time out in doctor/setup/uninstall at 5s; regular symlink setup/doctor/uninstall control passes.
  • Unchanged frozen public CLI regression: all four cases pass after. Nonregular fixtures remain intact and no backup is created; regular symlink and its unrelated setting are preserved.
  • Nine existing configuration/lifecycle owners: 146 pass / one platform skip.
  • npm run check, test discovery, npm pack --dry-run and installed npm run verify:package pass. Package verification includes planned/idempotent setup, backup/readback, failure recovery, symlink lifecycle, read-only update and MCP startup.
  • One combined after run had two startup deadline failures, including the regular control; unchanged isolated rerun passed. Both results retained; host contention is an inference, not proven cause.
  • Native FIFO proof is macOS arm64. Windows FIFO cases are explicitly skipped. Package fake-provider integration does not prove real Hopper/Ghidra behavior.
  • Later main through 39dabd0 does not modify these production owners. Hosted checks may still be pending.

AI assistance was used for investigation, implementation and verification.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

CassieFox23 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: This fix works. The red CI is not from this PR. Main had a broken test then. Main is fixed now. A re-run should go green.

Edit: added the OpenCode and Pi licenses.

Why CI is red

CI tested a merge with main at 08ec2bf. That main had a broken test from 001851f. The failing case was short-circuit mutation in JavaScriptSemanticGraphBuilder.test.ts.

This PR's own head starts before that commit. On the head alone, that file passes (54/54).

I rebuilt the CI merge without git. I took main at 08ec2bf. Then I applied this PR's diff with patch.

Tree That test file This PR's test
PR head e1d6001 54/54 pass 4/4 pass
main 08ec2bf 53 pass, 1 fail not run
main + PR 53 pass, 1 fail 4/4 pass
main + PR + b8a8190 54/54 pass 4/4 pass

The only failure is short-circuit mutation. b8a8190 on main fixes it. So a CI re-run should pass.

FIFO before and after

I used a throwaway HOME. The OpenCode (MIT) config was a FIFO. Each command ran under timeout 20.

Command 6.3.0 This PR
doctor --client opencode --json hangs, exit 124 exit 1 in 1.4s
setup --client opencode --dry-run --json hangs, exit 124 exit 1 in 1.2s
uninstall --json hangs, exit 124 exit 1 in 1.2s

Then I tried a symlink to a FIFO. In 6.3.0, doctor and setup hung. Uninstall already refused it there. This PR answers all three fast.

Doctor and setup now say this (I shortened the path):

Client configuration must be a regular file: <home>/.config/opencode/opencode.json. Select a regular configuration file, then rerun rea setup.

For a plain FIFO, uninstall says the same. It ends "then rerun uninstall." For the symlink, uninstall keeps its old "could not be safely verified" note.

The FIFO stayed a FIFO every time. The symlink stayed a symlink. No backup file was made. No process was left stuck.

Heads-up

PR #1376 (Pi client; Pi is MIT) edits three of the same files. That includes ClientRegistrationStatus.ts. I compared hunks only. I did not do a real merge. The hunks do not overlap. One hunk in SetupClientConfiguration.ts sits two lines away, though. patch applied both with a small fuzz.

Tests

  • This PR's new test file: 4/4 pass.
  • Full npm test on the PR head: 6062 pass, 89 skipped, 0 fail. It took about 9 minutes.
  • Not run: full npm test on the main + PR tree. Not run: Windows and macOS. The new tests skip Windows anyway.

Thanks, rudycelekli!

Test setup
  • Box: Linux (Nobara 44)
  • Node: 24.18.0

🤖 Generated with Claude Code (Opus 5.5) 🦊

@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you for the PR and the FIFO/symlink investigation. Closing as superseded by the shared regular-file boundary now on main: configuration/reference integration and bounded descriptor reads. Doctor, setup, maintenance and uninstall configuration reads now use the shared nonblocking regular-file admission, including setup readback; named read failures retain the selected path. The implementation reuses that boundary without the additional client-specific read wrapper.

The replacement passed typecheck, lint/module boundaries and formatting. This closure pass compared the source; it did not rerun the PR's CLI/FIFO tests or real providers.

@morluto morluto closed this Oct 10, 2026
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
@morluto morluto added the area: setup Setup, packaging, upgrade, install, Doctor, and client registration label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants