Repository navigation
feat: expose actionable model-decision diagnostics through /reflect - #11323
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
🟡 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)
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>
|
✅ Copilot review passed with no inline comments. @copilot Add the |
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>
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit bbc0d66 |
|
| 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
|
| 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
|
| 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
The failure is confined to the coverage comparison (a 0.01% branch-coverage drop reported in |

Extend
/reflectso 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
Bounded capture
Conservative guidance
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" } }