You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by "shahar1 (via GitHub)" <gi...@apache.org> on 2026/10/25 06:54:26 UTC

[PR] fix(agent-isolation): hint on container-gateway policy refusals [magpie]

shahar1 opened a new pull request, #1810:
URL: https://github.com/apache/magpie/pull/1810

   <!-- SPDX-License-Identifier: Apache-2.0
        https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!-- HUMAN SUMMARY - AGENTS DO NOT MODIFY -->
   <!-- END OF HUMAN SUMMARY -->
   
   <details><summary>AI Summary</summary>
   
   ## Summary
   
   - A sandboxed agent in an Apache Airflow checkout ran `breeze`. The container gateway correctly refused BuildKit `POST /grpc` and label-checked an untyped `docker inspect` of the CI image, but the agent never saw why: breeze captures `docker inspect` output, and buildx prints only `unable to upgrade to h2c, received 403`. It then routed around the gateway by building a host virtualenv, which the project forbids.
   - `sandbox-error-hint.sh` gains a branch for gateway policy refusals: the gateway's 403 body (`container-gateway: …; see docs/setup/sandbox-troubleshooting.md…`) and the bare `unable to upgrade to h2c, received 403`. The hint says the request was refused by policy, points at the `deny` lines in `container-gateway.log`, and tells the agent to report to the user instead of routing around it. Gateway 502 backend errors don't match.
   - The "403 container-gateway" troubleshooting entry now lists the workflows that can never pass the gateway: BuildKit sessions, bind-mounting the gateway socket, and untyped `docker inspect`, with breeze as the example. It also says that `excludedCommands` doesn't get past the gateway and what the agent should do.
   
   ## Type of change
   
   - [ ] Skill change (`.claude/skills/<name>/`) — eval fixtures updated below
   - [ ] Tool / bridge contract (`tools/<system>/*.md`)
   - [ ] Python package (`tools/*/` with `pyproject.toml`)
   - [ ] Groovy reference impl
   - [X] Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
   - [X] Documentation (`docs/`, `README.md`, `CONTRIBUTING.md`)
   - [ ] Project template (`projects/_template/`)
   - [ ] CI / dev loop (`prek`, workflows, validators)
   - [ ] Other:
   
   ## Test plan
   
   - [X] `prek run --from-ref upstream/main --to-ref HEAD` passes, including markdownlint, lychee, `isolated-setup-fingerprint` (re-stamped by the hook) and workspace pytest. `prek run lychee --all-files` passes too.
   - [X] `tools/agent-isolation/tests/test_sandbox_error_hint.py`: 23 passed. Both new positive cases exit 0 under the pre-change hook and 1 with it. The 502 negative case stays silent.
   - [ ] Not run: shellcheck (not installed; `bash -n` OK), the `sandbox-lint` CLI, and anything against a live gateway or Docker daemon.
   - Seen once, unrelated: `test_gpg_touch_overlay.py::test_signing_in_flight_matches_the_whole_process_name` failed under `-n auto` and passes alone. It looks like a system-wide `pgrep` racing a parallel `ssh-keygen`.
   
   ## RFC-AI-0004 compliance
   
   - [X] **Sandbox** — no gateway, policy or sandbox settings change. The hook only adds a note to the tool result and never allows or blocks anything.
   - [X] **Vendor neutrality** — breeze appears only as an example of a tool that hits the refusals.
   
   ## Linked issues
   
   Refs apache/airflow#75599 (the Airflow-side AGENTS.md change: stop and report when breeze can't run).
   
   ## Notes for reviewers (optional)
   
   Considered and left out:
   - BuildKit support in the gateway. It needs an h2c/protobuf inspector and a privileged builder.
   - A 404 instead of 403 for missing or foreign containers. It would reverse the no-detection decision in `relay.py` and still not unblock breeze.
   
   Known stale counts not touched here: "Five classes of failure" in `secure-agent-setup.md`, the hook header comment, and `tools/agent-isolation/README.md` "four known … signatures".
   
   </details>
   
   Generated-by: Claude Code (Opus 5.5, Sonnet 5.5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(agent-isolation): hint on container-gateway policy refusals [magpie]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #1810:
URL: https://github.com/apache/magpie/pull/1810#discussion_r4369959781


##########
tools/agent-isolation/tests/test_sandbox_error_hint.py:
##########
@@ -135,6 +137,25 @@
         assert result.returncode == 1
         assert f"{DOC}#docker--podman-command-fails-with-a-socket-error" in result.stderr
 
+    @pytest.mark.parametrize(
+        "stderr",
+        [
+            "Error response from daemon: container-gateway: label-check: buildx_buildkit_default does not "
+            "belong to this project; see docs/setup/sandbox-troubleshooting.md#docker--podman-command-fails-with-a-socket-error",

Review Comment:
   ## CodeQL / Implicit string concatenation in a list
   
   Implicit string concatenation. Maybe missing a comma?
   
   [Show more details](https://github.com/apache/magpie/security/code-scanning/161)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(agent-isolation): hint on container-gateway policy refusals [magpie]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #1810:
URL: https://github.com/apache/magpie/pull/1810


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org