Skip to content

feat(cli): add API proxy reflection mode - #6936

Merged
lpcox merged 6 commits into
mainfrom
copilot/github-6930-reflect-cli-arg
Aug 5, 2026
Merged

feat(cli): add API proxy reflection mode#6936
lpcox merged 6 commits into
mainfrom
copilot/github-6930-reflect-cli-arg

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Inspect existing reflection endpoint and CLI structure
  • Add a focused CLI mode that starts AWF, requests /reflect, and prints JSON
  • Add focused tests and validate the new mode
  • Run final security review and complete

The completed implementation keeps entrypoint diagnostics on stderr so awf --reflect stdout remains parseable JSON. The final security review found no vulnerabilities.

Copilot AI linked an issue Aug 4, 2026 that may be closed by this pull request
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI requested a review from lpcox August 4, 2026 21:36
@lpcox
lpcox marked this pull request as ready for review August 4, 2026 23:23
Copilot AI balanced review requested due to automatic review settings August 4, 2026 23:23

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.

Pull request overview

Adds a dedicated --reflect mode for querying the API proxy’s reflection endpoint.

Changes:

  • Adds the --reflect CLI option and command validation.
  • Executes /reflect through the AWF agent.
  • Adds unit tests and usage documentation.
Show a summary per file
File Description
src/commands/main-action.ts Implements reflection-mode execution.
src/commands/main-action.test.ts Tests reflection mode and command conflicts.
src/cli-options.ts Registers the new CLI option.
README.md Documents reflection usage.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/commands/main-action.ts
@github-actions

github-actions Bot commented Aug 4, 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 Aug 4, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit c7434c3

@github-actions

github-actions Bot commented Aug 4, 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 98.94% 98.89% 📉 -0.05%
Statements 98.83% 98.78% 📉 -0.05%
Functions 99.19% 99.10% 📉 -0.09%
Branches 95.15% 94.96% 📉 -0.19%
📁 Per-file Coverage Changes (6 files)
File Lines (Before → After) Statements (Before → After)
src/artifact-preservation.ts 96.3% → 93.2% (-3.08%) 96.3% → 93.2% (-3.06%)
src/services/bounded-agent-service.ts 98.5% → 97.0% (-1.45%) 97.1% → 95.8% (-1.31%)
src/bounded-agent/preflight.ts 97.6% → 97.0% (-0.67%) 97.7% → 97.1% (-0.64%)
src/commands/main-action.ts 97.3% → 97.4% (+0.07%) 96.8% → 96.9% (+0.08%)
src/artifact-permissions.ts 97.4% → 98.0% (+0.52%) 97.4% → 98.0% (+0.52%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)

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

@lpcox lpcox changed the title [WIP] Implement CLI mode to run /reflect and print JSON output feat(cli): add API proxy reflection mode Aug 4, 2026
lpcox added 2 commits August 4, 2026 16:51
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2e281ab2-e1f4-42a2-9798-47863526dc60
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2e281ab2-e1f4-42a2-9798-47863526dc60
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Security Guard completed successfully!

Security review complete for PR #6936. Changes to containers/agent/entrypoint.sh add output routing via file descriptor manipulation to separate entrypoint diagnostics from user command stdout. No security-weakening changes detected: no capability additions, no firewall chain modifications, no proxy/domain bypass, no input validation weakening, no secrets exposure, no seccomp relaxations. The output isolation pattern improves separation of concerns. PR passes security review.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Security Guard completed successfully!

Security review complete for PR #6936. Analysis: Changes are confined to containers/agent/entrypoint.sh and add output routing functions to isolate command stdout from entrypoint diagnostics. No DROP/REJECT rules weakened, no capabilities added, no ACL expansion, no input validation weakening, no secrets exposed. Changes maintain existing security boundaries. No security issues found.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com

Overall: PASS

cc @lpcox

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine — Overall: ✅ PASS

cc @lpcox

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
gh check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #6936 · haiku45 · 56.3 AIC · ⊞ 3.6K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results: Services Connectivity

  • Redis: ❌ Temporary failure in name resolution
  • PostgreSQL pg_isready: ❌ no response
  • PostgreSQL SELECT 1: ❌ could not translate host name

Overall: FAILhost.docker.internal did not resolve inside the AWF sandbox.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OTEL Tracing — All Scenarios ✅

  1. Module Loading ✅ — otel.js loads; isEnabled() true; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, _parseEndpoints, _parseOtlpHeaders, _buildResourceSpans (+ exporter classes).
  2. Test Suite ✅ — 2 suites, 59/59 tests passed (otel.test.js, otel-fanout.test.js): span creation, gen_ai token attrs, parent trace propagation, ProxyAwareOtlpExporter, FileSpanExporter, fan-out export.
  3. Env Var Forwarding ✅ — env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID to agent; api-proxy-env-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, and trace context to api-proxy.
  4. Token Tracker Integration ✅ — token-tracker-http.js exposes onUsage callback as OTEL hook point.
  5. OTEL Diagnostics ✅ — /tmp/gh-aw/otel.jsonl contains an exported span (gh-aw.agent.setup) with trace/parent-span IDs, confirming export path works.

All scenarios pass — OTEL tracing integration validated.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (api.github.com) reachable: allowed=200
✅ Blocked domain (example.com) denied: proxy CONNECT tunnel 403

Overall: PASS

@lpcox

Warning

Firewall blocked 1 domain

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

  • example.com

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

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini Engine Validation

  • GitHub MCP: ✅
  • Connectivity: ❌
  • File Writing: ✅
  • Bash Tool: ✅

FAIL

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A (build only) ✅ PASS
C++ json N/A (build only) ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A (run only) ✅ PASS
.NET json-parse N/A (run only) ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

All repositories cloned and all 18 test projects built/ran/tested successfully through the AWF firewall (Squid proxy egress control). Note: Java required overriding the Maven localRepository to a writable path (~/.m2/repository was not writable in this sandbox) — this was an environment permission issue unrelated to firewall behavior.

Generated by Build Test Suite for #6936 · auto · 38 AIC · ⊞ 11.5K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🧪 Smoke Test: Docker Sbx

Overall: PASS

cc @lpcox

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

feat(cli): add API proxy reflection mode

  • fix: demote benign rootless cleanup errors ✅
  • [WIP] Fix token steering to respect explicit provider configuration ✅
  • safeinputs-gh PR list ✅
  • Playwright GitHub title ✅
  • file write/read ✅
  • discussion lookup ✅
  • npm ci && npm run build ❌
    Overall: FAIL

Warning

Firewall blocked 1 domain

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

  • registry.npmjs.org

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

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13 ✅ YES
Node.js v24.18.0 v22.23.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: FAILED — Node.js version mismatch between host and chroot environment. Not adding the smoke-chroot label since not all tests passed.

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

@lpcox
lpcox merged commit 994f3f9 into main Aug 5, 2026
138 of 141 checks passed
@lpcox
lpcox deleted the copilot/github-6930-reflect-cli-arg branch August 5, 2026 06:00
github-actions Bot added a commit that referenced this pull request Aug 5, 2026
PR #6936 (feat(cli): add API proxy reflection mode) introduced the
--reflect CLI flag but did not add it to the Section 5 CLI Mapping
table in docs/awf-config-spec.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lpcox pushed a commit that referenced this pull request Aug 5, 2026
PR #6936 (feat(cli): add API proxy reflection mode) introduced the
--reflect CLI flag but did not add it to the Section 5 CLI Mapping
table in docs/awf-config-spec.md.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

reflect cli arg

3 participants