Skip to content

feat: expose actionable model-decision diagnostics through /reflect - #11323

Merged
lpcox merged 8 commits into
mainfrom
copilot/feat-expose-agent-facing-model-diagnostics
Nov 8, 2026
Merged

lpcox merged 8 commits into
mainfrom
copilot/feat-expose-agent-facing-model-diagnostics

Conversation

Copilot AI commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Extend /reflect so agents can distinguish known rejection from missing evidence, avoid unchanged invalid retries, and recognize estimated costs. Existing policy, accounting, request-pinning, and pricing-error semantics remain authoritative.

  • Evidence contract

    • Schema-validated, additive diagnostics separate current metadata, captured request outcomes, and aggregate accounting.
    • Include verified identity, normalized scope, request-pinned revisions, sanitized explanations, and constrained action/retry classifications.
  • Bounded capture

    • Observe completed primary-proxy policy, effort, and harness rejections.
    • Retain 32 deduplicated outcomes for 15 minutes; exclude prompts, headers, provider payloads, and private deployment identifiers.
    • Leave fallback rejection identity unknown unless the rejecting response supplies it.
  • Conservative guidance

    • Unknown evidence never becomes support, availability, or permission.
    • Reuse existing direct/family/backend/fallback pricing provenance without repricing, refreshing discovery, or selecting replacements.
    • Preserve pricing HTTP 500 responses and surface existing latched accounting failures.

Example policy rejection, excerpt:

{
  "kind": "request_outcome",
  "identity": { "provider": "copilot", "model_id": null },
  "status": "rejected",
  "reason": "policy_denied",
  "action": { "kind": "change_request", "retry": "do_not_repeat" }
}
  • Completion boundary
    • Document concrete agent responses and older-version absence semantics.
    • Dedicated-enclave history/accounting attribution, shared reasoning handoff, no-donor capture, and non-routed upstream outcomes remain unavailable—not inferred.

Copilot AI and others added 2 commits November 8, 2026 17:58
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve /reflect response with model decision diagnostics feat: expose actionable model-decision diagnostics through /reflect Nov 8, 2026
@lpcox
lpcox marked this pull request as ready for review November 8, 2026 18:10
Copilot AI adaptive review requested due to automatic review settings November 8, 2026 18:10
Copilot AI requested a review from lpcox November 8, 2026 18:10

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

Active diagnostic defects misattribute providers and backends, miss explicit Copilot capability advertisements, omit routing failures under the entry limit, and infer subsystem decisions from unqualified upstream errors.

5 open issues
What changed in this PR

Extends AWF’s existing /reflect endpoint with agent-facing model-decision diagnostics, separating current metadata, completed request rejections, and aggregate pricing evidence.

Changes:

  • Defines schema-validated diagnostics with evidence-based action and retry guidance.
  • Integrates bounded rejection capture and read-only accounting projections.
  • Adds regression coverage and documents agent workflows, privacy boundaries, and unavailable evidence.
File Description
docs/​api-proxy-sidecar.md Documents diagnostic examples, recommended responses, and limitations.
containers/​api-proxy/​server.js Wires observation and trusted proxy context into production handlers.
containers/​api-proxy/​model-decision-reflection.test.js Covers production dispatch, rejection capture, and accounting error behavior.
containers/​api-proxy/​model-decision-observation.js Captures bounded, deduplicated local rejection outcomes.
containers/​api-proxy/​model-decision-diagnostics.test.js Tests projection contracts, retention, privacy, and legacy compatibility.
containers/​api-proxy/​model-decision-diagnostics.schema.json Defines the additive diagnostics contract.
containers/​api-proxy/​model-decision-diagnostics.js Projects current metadata, captured outcomes, and pricing classifications.
containers/​api-proxy/​management.js Adds optional diagnostics to the existing reflection response.
containers/​api-proxy/​Dockerfile Packages the new modules and schema in the proxy image.

Review effort: Max (auto)

lpcox and others added 2 commits November 8, 2026 10:29
Add check for cross-provider fallback rejection scope.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Adjust current decisions to limit based on snapshot budget.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 8, 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.

lpcox and others added 3 commits November 8, 2026 10:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 8, 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-11323 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit bbc0d66

@github-actions

github-actions Bot commented Nov 8, 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.81% 93.80% 📉 -0.01%
Statements 92.35% 92.35% ➡️ +0.00%
Functions 93.02% 93.02% ➡️ +0.00%
Branches 86.69% 86.69% ➡️ +0.00%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/commands/main-action.ts 92.0% → 91.7% (-0.25%) 91.7% → 91.4% (-0.24%)

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

@github-actions

github-actions Bot commented Nov 8, 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.81% 93.81% ➡️ +0.00%
Statements 92.36% 92.36% ➡️ +0.00%
Functions 93.02% 93.02% ➡️ +0.00%
Branches 86.70% 86.69% 📉 -0.01%
📁 Per-file Coverage Changes (3 files)
File Lines (Before → After) Statements (Before → After)
src/nvx/one-shot-process.ts 84.0% → 81.5% (-2.47%) 76.8% → 74.7% (-2.11%)
src/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 89.8% → 90.1% (+0.29%)
src/commands/main-action.ts 91.7% → 92.0% (+0.25%) 91.4% → 91.7% (+0.24%)

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

@github-actions

github-actions Bot commented Nov 8, 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.81% 93.80% 📉 -0.01%
Statements 92.36% 92.35% 📉 -0.01%
Functions 93.02% 93.02% ➡️ +0.00%
Branches 86.70% 86.69% 📉 -0.01%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/nvx/one-shot-process.ts 84.0% → 81.5% (-2.47%) 76.8% → 74.7% (-2.11%)
src/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 89.8% → 90.1% (+0.29%)

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

@lpcox

lpcox commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Copilot AI commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix failing ci check https://github.com/github/gh-aw-firewall/actions/runs/42510339428/job/128821826784?pr=11323

The failure is confined to the coverage comparison (a 0.01% branch-coverage drop reported in src/nvx/one-shot-process.ts), which is outside this PR’s changed files. I requested a retry of the failed run; attempt 2 is queued. I made no code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: expose actionable agent-facing model decision diagnostics through /reflect

3 participants