← Back to Pull requests

fix(app): classify unknown tool surface as usage, not provider error #286

Open
unknown opened this pull request with 178 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 17, 2026 15:27 UTC
Author

Scope

Unknown-tool usage classification packet (metadata: dropbox:/FlowState/Metadata/attempts/2026-11-17-unknown-tool-usage/admission.json). Observed live in the tool-loop dogfood: --allow exec.run without FLOWSTATE_EXEC_ENABLED=1 advertised the tool to the model, then surfaced mid-run as provider_error exit 3 — a code the contract reserves for provider failures.

Now: the loop's tool-definitions step classifies as usage (exit 2) before any provider request or budget spend, with a message naming the tool and — for exec.run — the FLOWSTATE_EXEC_ENABLED gate. finishRun gains the usage arm ahead of the provider fallback.

Acceptance scenarios (QA-verified)

  • --allow exec.run without the gate: exit 2, code usage, names tool + gate, zero provider requests, no tool.* events

  • --allow totally.unknown.tool: exit 2 usage naming the tool

  • Enabled path unchanged (exit 0); genuine provider failure still exit 3 provider_error

  • 8 new e2e Its, one expectation each; suite race-clean x2
  • Gates at exact head dc3644fe (base b21ffd6a)

  • Independent QA: 13 executed checks, verdict ACCEPT; provider-request-count zero proofs

  • check-size-live 90/600 lines, 4/10 files; fmt clean; pre-existing internal/swarm lint failure reproduced byte-identical on pristine base (untouched packages)
  • Base: b21ffd6a4493c25ac2ed34e6174428c6b1dc6aaf

    Independent review (exact-head)

    Agent-Review: pending

    Diff: 178 lines (+133 / -45) across 2 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 2m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.35) × (1 − Review Confidence (0.32)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 178 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 58% · Reviewer familiarity: 35%
    31%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.310
    Real PR Conversation Timeline
    1 comments
    "Review active on #286"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 31.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.5% (MEDIUM) · Higher = larger blast radius
    35.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 31.9% · Lower = rushed or shallow review
    31.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.2% · Safe to merge
    24.2%