Repository navigation
fix(setup): stop doctor probe 3 reporting a live gateway as not running - #1815
Merged
potiuk merged 1 commit intoOct 25, 2026
Merged
Conversation
On a marketplace install the adopter repository has neither .apache-magpie/tools/container-gateway/src nor tools/container-gateway/src, so the probe's `status` call failed to import, returned nothing, and was read as "gateway not running" before the socket or `<rt> info` was ever tried. The probe told operators to restart a gateway that was serving. Fall back to the operator install the SessionStart hook itself runs ($HOME/.claude/scripts/container-gateway/src), which the reference allowRead already covers. When there is still no status, say so instead of "not running": only `status` can vouch that the socket is the gateway's, so the probe fails with the reason rather than trusting a socket a raw daemon would answer just as well. A `status` that exits 2 without a report has refused the run directory, and is reported as such. Generated-by: Claude Opus 5
potiuk
enabled auto-merge (squash)
October 25, 2026 14:57
potiuk
disabled auto-merge
October 25, 2026 14:57
potiuk
added a commit
to potiuk/magpie
that referenced
this pull request
Oct 25, 2026
The test file apache#1815 added is not ruff-formatted, so the workspace ruff-format hook fails on main and on every PR built on it. Generated-by: Claude Opus 5
potiuk
added a commit
to potiuk/magpie
that referenced
this pull request
Oct 25, 2026
main's prek has failed on this file since apache#1815. Generated-by: Claude Code (Claude Opus 5)
potiuk
added a commit
that referenced
this pull request
Oct 25, 2026
…tainer command (#1814) * fix(container-gateway-hook): start the gateway on demand before a container command The gateway exits mid-session after its idle timeout, when another session on the same project ends, or on a crash, and only SessionStart ever started it again. A new ensure action, wired as a PreToolUse hook on Bash, starts it before a docker/podman command, after the same trust checks as start. Generated-by: Claude Opus 5 * style(setup): ruff-format the doctor probe 3 tests main's prek has failed on this file since #1815. Generated-by: Claude Code (Claude Opus 5) * fix(container-gateway-hook): judge the session's project, not the agent's cwd The payload's cwd follows the agent's cd: before every tool call, and at the SessionStart that follows a compaction, /clear or resume. Judged from another directory, the session project's own write grants went uncounted, so a sandboxed cd elsewhere could get a source or interpreter the sandbox can write past the trust checks. Every action now takes the directory from CLAUDE_PROJECT_DIR, which Claude Code sets on every hook to the directory the session started in; it does not follow cd, and a settings env entry cannot override it (checked against Claude Code). start and stop fall back to the payload's cwd when it is unset; ensure does nothing. The payload's cwd and its settings are counted as writable too. Generated-by: Claude Code (Claude Opus 5)
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
isolated-setup-doctorprobe 3 reported✗ gateway socket missing … container gateway not runningwhile the gateway was serving anddocker versionworked through it. The adopter repository has neither.apache-magpie/tools/container-gateway/srcnortools/container-gateway/src, so the probe'sstatuscall could not import, returned nothing, andgw_statemapped that tonot-runningbefore the socket or<rt> infocheck ran.SessionStarthook itself runs ($HOME/.claude/scripts/container-gateway/src, install Step L.1), which the referenceallowReadalready covers.statuscan vouch that the socket is the gateway's (a raw daemon socket answers<rt> infojust as well), so with no gateway source, or astatusthat exits without a report (e.g. macOS's/usr/bin/python33.9 cannot import the gateway), the probe reports✗ gateway status unavailable — <reason>and never✓.statusthat exits 2 without a report has refused the run directory (validate_run_dirraisesSystemExit(2)on a symlinked or wrongly owned component); the probe reports✗ gateway status refused the run directory.SKILL.mddocuments the third source and both new results; its token stamp is refreshed.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --fileson the changed files passesuv run pytest/ruff check/mypypassestests/test_probe_3_container_gateway.py, 10/10 withpython3 -m unittest, run outside the sandbox so the socket fixtures can bind. Four fail onmain:test_operator_install_source_used— stub gateway under$HOME/.claude/scripts/container-gateway/srcreporting no backend → the "running without a docker backend" branch.test_no_gateway_source_is_not_a_pass— no gateway source, live socket, working CLI →✗ gateway status unavailable — no gateway source …, never✓.test_status_import_failure_is_not_a_refusal—statusexits 1 with no output →✗ gateway status unavailable — status exited rc=1 ….test_status_refusal_is_reported—statusexits 2 with no output, live socket →✗ gateway status refused the run directory.test_gateway_not_runningnow uses a stub reporting"running": false, since a missing source no longer means "not running".RFC-AI-0004 compliance
statussubcommand, from inside the sandbox, against a path the referenceallowReadalready grants.Linked issues
Refs #1775, #1776 (earlier probe 3 fix for
/tmpwrites; this is a separate defect).Notes for reviewers (optional)
The hook deliberately refuses sandbox-writable gateway sources because it runs outside the sandbox. The probe runs inside it and only reads status, so that rule does not bind here; the new fallback is the same operator copy the hook uses.
🤖 Generated with Claude Code