Skip to content

fix(ipc): chmod 666 the Unix socket so cross-UID callers can connect (closes #1008)#1011

Merged
joelteply merged 2 commits into
canaryfrom
fix/1008-ipc-socket-perms-cross-uid
May 2, 2026
Merged

fix(ipc): chmod 666 the Unix socket so cross-UID callers can connect (closes #1008)#1011
joelteply merged 2 commits into
canaryfrom
fix/1008-ipc-socket-perms-cross-uid

Conversation

@joelteply
Copy link
Copy Markdown
Contributor

Summary

continuum-core runs as root inside its Docker Desktop / WSL2 container and binds /tmp/continuum-core.sock with default permissions (rwx by owner only). The host-side jtag, running as the Windows-WSL user (uid 1000), then gets EACCES on connect — Phase 4 chat probe blocked, full stack otherwise healthy.

Caught live by continuum-b69f 2026-05-02 during Carl-OOTB Windows test. Mac and Linux dev mode are unaffected because server + caller both run as the same user.

Fix

After UnixListener::bind, explicitly set_permissions(0o666) on the socket path. 0o666 is appropriate for an IPC substrate socket that lives in a path the caller can already see — same blast radius as anything reading /tmp.

Failing-loud (propagating any chmod error via ? rather than swallowing) is intentional per the global "evidence is for the debugger" rule.

Stacked on

This PR includes the env_remove fix from #1009 as a parent commit (it was needed locally to push through the pre-push hook). When #1009 merges first, this PR's diff against canary will reduce to just the 16-line socket-perms change. If reviewer prefers, can rebase after #1009 merges.

Test plan

  • cargo build --lib --features metal,accelerate clean
  • CI green
  • Live: b69f re-runs Carl-OOTB Phase 4 on Windows after this lands → jtag connects → chat probe succeeds

Closes

🤖 Generated with Claude Code

Test and others added 2 commits May 2, 2026 00:55
Root cause for the pre-push hook's git_bridge::tests cluster failure:

When `cargo test --lib` is invoked by the pre-push hook (which is
itself invoked by `git push`), git sets context env vars (GIT_DIR,
GIT_PREFIX, etc.) on the hook process. Those env vars propagate to
every child — including cargo, including the test binary, including
the tempdir `git init`/`git commit` calls inside the tests.

So when a test does `git commit` in its tempdir, git inherits
GIT_DIR=/Users/joelteply/.../continuum/.git, runs the parent
worktree's pre-commit hook (which itself shells `<repo>/src/scripts/
git-precommit.sh`), and panics because that script's path doesn't
exist relative to the tempdir.

Surface symptom: 9-of-9 git_bridge tests fail when run via the
pre-push hook with errors like:
  - "could not lock config file <bare>/.git/config: File exists"
  - "Unable to create '<bare>/.git/worktrees/<x>/index.lock'"
  - "<bare>/.git/hooks/pre-commit: <tmp>/src/scripts/git-precommit.sh:
     No such file or directory"

All three are symptoms of the same upstream cause: GIT_DIR pinning
git to the parent worktree regardless of cwd.

Fix: strip GIT_DIR / GIT_WORK_TREE / GIT_COMMON_DIR / GIT_INDEX_FILE
/ GIT_PREFIX from the environment when invoking git via run_git.
Also set GIT_CEILING_DIRECTORIES=workspace_root as defense-in-depth
against future git env vars.

This makes run_git context-clean: git discovers from current_dir
only, no parent contamination.

## Tests

Reproduces previously-failing case: simulate hook env by exporting
GIT_DIR before cargo test:
  Before: GIT_DIR=<continuum>/.git cargo test --lib code::git_bridge
          → 9 failures with "could not lock config file"
  After:  same command → 9 passed; 0 failed

Caught by continuum-b69f's pre-push run on 2026-05-02. Unblocks any
PR (PowerShell-only, docs-only, TS-only) from the spurious pre-push
fail. Also makes run_git production-safer: hooks invoking continuum-
core's git_bridge functions get a clean context.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…1008)

Bug observed live by continuum-b69f 2026-05-02 during Carl-OOTB
Windows Phase 4: continuum-core runs as root inside its Docker
Desktop / WSL2 container and binds /tmp/continuum-core.sock with
default permissions (rwx by owner only). The host-side jtag,
running as the Windows-WSL user (uid 1000), then gets EACCES on
connect — Phase 4 chat probe blocked, full stack otherwise healthy.

Mac and Linux dev mode are unaffected because the server + the
caller both run as the same user.

Fix: after `UnixListener::bind`, explicitly `set_permissions(0o666)`
on the socket path. 0o666 is appropriate for an IPC substrate socket
that lives in a path the caller can already see — same blast radius
as anything reading /tmp.

Failing loud (propagating any chmod error via `?` rather than
swallowing) is intentional per the global "evidence is for the
debugger" rule.

## Tests

cargo build --lib --features metal,accelerate: clean.
Unit tests for the binary path are end-to-end (need a continuum-core
binary running) — covered by Carl-OOTB Phase 4 chat probe in
scripts/ci/carl-install-smoke.sh + b69f's manual repro on Windows.

## Closes

- #1008 — IPC socket EACCES blocking cross-UID callers, surfaces as
  Phase 4 chat probe failure on Carl-OOTB Windows test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joelteply joelteply merged commit b1a1dbc into canary May 2, 2026
3 checks passed
@joelteply joelteply deleted the fix/1008-ipc-socket-perms-cross-uid branch May 2, 2026 14:29
joelteply pushed a commit that referenced this pull request May 3, 2026
joelteply added a commit to RebelTechPro/continuum that referenced this pull request May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant