Skip to content

fix: align Claude enclave tool approvals with output contract - #11240

Merged
lpcox merged 14 commits into
mainfrom
copilot/resolve-claude-enclave-permission-denial
Nov 7, 2026
Merged

lpcox merged 14 commits into
mainfrom
copilot/resolve-claude-enclave-permission-denial

Conversation

Copilot AI commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude could exit successfully while tool refusal left required /awf/out empty. Production approved only read tools; the successful pinned fixture substituted shell/write approvals instead of exercising production policy.

  • AWF-owned policy

    • Approve shell diagnostics and file operations through the fixed child environment, independent of task text, caller fields, or inherited settings:
      --permission-mode default --permission-prompts none
      --allowedTools Bash,Read,Write,Edit,Glob,Grep
      
    • Preserve non-root identity, zero capabilities, read-only root/seed, bounded storage, dedicated networking, and deadlines.
  • Bounded diagnostics

    • Retain finite tool classes to distinguish native refusals from output-write tool errors without exposing arguments or model content.
    • Preserve denial/error classes and final result milestones beyond stream-capture and projected-event limits.
  • Production-path coverage

    • Exercise pinned Claude 2.1.280 with unchanged production approvals and a deterministic local provider.
    • Cover genuine diagnostic success, refusal/no-output, output-write failure, and capture saturation. Native exit 0 with empty output remains result-empty (33).

Copilot AI changed the title [WIP] Resolve Claude enclave tool-permission denial to prevent empty output fix: align Claude enclave tool approvals with output contract Nov 7, 2026
@lpcox
lpcox marked this pull request as ready for review November 7, 2026 02:12
Copilot AI adaptive review requested due to automatic review settings November 7, 2026 02:12
Copilot AI requested a review from lpcox November 7, 2026 02:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

On the legacy gVisor runner, the new approvals let caller-directed tasks overwrite the session transcript and expose private data through audit artifacts outside result-schema and disclosure limits.

2 open issues
What changed in this PR

This PR aligns AWF’s Claude enclave tool approvals with shell diagnostics and the required /awf/out contract, while expanding bounded diagnostic evidence.

Changes:

  • Sets an AWF-owned policy permitting shell and file operations.
  • Adds finite tool classifications and preserves denial, error, and result milestones beyond event limits.
  • Updates production-policy fixtures, failure coverage, and architecture documentation.
File Description
src/​enclave/​claude-unattended.test.ts Updates opt-in pinned-CLI fixtures for production approvals and output failures.
src/​enclave/​agent-provider-environment.test.ts Checks fixed approvals despite inherited or caller-supplied settings.
src/​enclave/​agent-entrypoint-diagnostics.test.ts Covers tool classifications, empty output, and capture saturation.
scripts/​ci/​collect-enclave-smoke-debug.test.ts Tests diagnostic retention and validation after event saturation.
scripts/​ci/​collect-enclave-smoke-debug.cjs Accepts and validates the new diagnostic fields.
docs/​enclaves-architecture.md Documents finite classifications and retention guarantees.
containers/​enclave/​agent-executor/​session-diagnostics.js Preserves denial classes, tool errors, and final results.
containers/​enclave/​agent-executor/​agent-provider-environment.js Sets fixed unattended Claude shell/file approvals.
containers/​enclave/​agent-entrypoint.py Classifies tools and correlates requests with completion errors.

Review effort: Max (auto)

AWF_ENCLAVE_AGENT_CLAUDE_ALLOWED_TOOLS: 'Read,Glob,Grep',
// Fixed AWF policy: shell diagnostics and /awf/out writes remain inside the outer sandbox.
AWF_ENCLAVE_AGENT_CLAUDE_PERMISSION_PROMPTS: 'none',
AWF_ENCLAVE_AGENT_CLAUDE_ALLOWED_TOOLS: 'Bash,Read,Write,Edit,Glob,Grep',
]));
});

pinnedTest.each([
@lpcox

lpcox commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot address all review feedback

Copilot AI commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address all review feedback

Addressed both review requests in d5a8f9b: the Claude engine runs without write access to the supervisor-owned transcript, and CI installs Claude 2.1.280 to run the pinned launch fixtures. The 313 targeted tests and 20 storage-helper tests pass.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11240 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 999b29f

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Test Suite completed successfully!

Generated by Build Test Suite for #11240

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot BYOK AOAI (api-key) is testing Azure OpenAI BYOK (api-key) mode on this pull request...

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • clients2.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "clients2.google.com"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Smoke Claude passed

Generated by Smoke Claude for #11240

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.

Cloud Hypervisor + Copilot smoke test by Smoke Cloud Hypervisor

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.16 Python 3.12.16 ✅ YES
Node.js v24.22.2 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: Not all tests passed (Node.js version mismatch), so the smoke-chroot label was not added.

Tested by Smoke Chroot
Add label ready-for-aw to run again

Copilot AI commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address all review feedback and fix this failing ci check https://github.com/github/gh-aw-firewall/actions/runs/42331349205/job/128323727121?pr=11240

Fixed and pushed as e18d90c. The full root suite passes (12,415 tests) and the affected suites pass (498 tests). Python CodeQL reports no alerts; JavaScript analysis was skipped because the database exceeded tool limits.

AWF_ENCLAVE_AGENT_CLAUDE_ALLOWED_TOOLS: 'Read,Glob,Grep',
// Fixed AWF policy: shell diagnostics and /awf/out writes remain inside the outer sandbox.
AWF_ENCLAVE_AGENT_CLAUDE_PERMISSION_PROMPTS: 'none',
AWF_ENCLAVE_AGENT_CLAUDE_ALLOWED_TOOLS: 'Bash,Read,Write,Edit,Glob,Grep',
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@lpcox

lpcox commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main and resolve conflicts then address all remaining review feedback

Copilot AI added 2 commits November 7, 2026 15:07
…e-enclave-permission-denial

# Conflicts:
#	containers/enclave/agent-executor/session-diagnostics.js
#	scripts/ci/collect-enclave-smoke-debug.cjs
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Copilot AI commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and resolve conflicts then address all remaining review feedback

Merged main in fcbc9fc and addressed the credential-boundary feedback in 5b8261a. Claude GitHub MCP remains unsupported and is rejected before credential mounts or engine launch; the working unattended output policy is retained. The full root suite passed (12,500 tests), including pinned Claude fixtures. CodeQL found no Python or Actions alerts; JavaScript analysis exceeded its database limit.

lpcox and others added 2 commits November 7, 2026 07:41
Track transcript close errors explicitly and stage the pinned native Claude executable outside private runner installation paths before dropping the engine identity. Cover symlink resolution, byte preservation, and executable mode in a portable regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread src/enclave/claude-unattended.test.ts Resolved
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 93.78% 93.77% 📉 -0.01%
Statements 92.32% 92.31% ➡️ -0.01%
Functions 93.02% 93.02% ➡️ +0.00%
Branches 86.61% 86.58% 📉 -0.03%
📁 Per-file Coverage Changes (3 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/invocation-staging.ts 100.0% → 97.1% (-2.86%) 100.0% → 97.3% (-2.71%)
src/commands/main-action.ts 92.0% → 91.7% (-0.25%) 91.7% → 91.4% (-0.24%)
src/enclave/docker-host-executor.ts 95.2% → 95.0% (-0.21%) 89.7% → 89.5% (-0.16%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Use one descriptor for staged executable checks and reads. Keep ownership operations separate from the generic resource-returning I/O wrapper, preserving redacted errors and exception propagation. Restore the explicitly selected fixed sandboxed Claude tool policy after autofix removed required shell and output tools.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lpcox and others added 2 commits November 7, 2026 08:03
…losed'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Route diagnostic fixture faults through the actual path.open boundary. Preserve exact open/close failure classification without relabeling already-reported read/write failures, while retaining direct context-managed file lifetime for CodeQL.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 93.78% 93.77% 📉 -0.01%
Statements 92.32% 92.31% ➡️ -0.01%
Functions 93.02% 93.02% ➡️ +0.00%
Branches 86.61% 86.58% 📉 -0.03%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/invocation-staging.ts 100.0% → 97.1% (-2.86%) 100.0% → 97.3% (-2.71%)
src/commands/main-action.ts 92.0% → 91.7% (-0.25%) 91.7% → 91.4% (-0.24%)
src/enclave/docker-host-executor.ts 95.2% → 95.0% (-0.21%) 89.7% → 89.5% (-0.16%)
src/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 90.1% → 89.8% (-0.29%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox
lpcox merged commit 619bdd8 into main Nov 7, 2026
47 of 48 checks passed
@lpcox
lpcox deleted the copilot/resolve-claude-enclave-permission-denial branch November 7, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve Claude enclave tool-permission denial that leaves required output empty

4 participants