Skip to content

feat(judge): decide tool approvals with a decision model through /v1/decisions - #1691

Merged
edenreich merged 4 commits into
mainfrom
feat/issue-1342-decision-judge
Nov 4, 2026
Merged

edenreich merged 4 commits into
mainfrom
feat/issue-1342-decision-judge

Conversation

@edenreich

@edenreich edenreich commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The tool-approval judge gains a second backend. judge.yaml backend: decisions asks a decision model through the gateway's POST /v1/decisions and thresholds its p(approve), instead of asking a generative model for a JSON verdict and parsing prose. Every decision call goes through the gateway via the Go SDK: the cli never speaks a vendor's decision format and holds no vendor credential. The provider/model prefix picks the upstream exactly as for chat completions.

Closes #1342

Changes

  • internal/decision/ - new bounded context. domain/ holds Question (predicate | choice | score), Answer, Decisions and the Decider port. infrastructure/gateway/ is the only adapter: builds sdk.CreateDecisionRequest, calls CreateDecision, maps the typed answers back by name. README explains what, why and how it plugs in.
  • internal/agent/loop/decision_judge.go - DecisionJudge implements JudgeApprover. Evidence is the same rendered prompt the LLM judge sees. Per batch: one predicate per gated call named by its tool call id, plus one choice named risk (benign, destructive, network, secrets, out_of_scope, each with a criterion). Approved iff probability >= min_confidence. Reasons carry the probability and risk class so the agent adjusts and RequestApproval escalation keeps working. on_error, batching (20 calls), usage accounting, judge_verdict events and the TUI indicator are unchanged. newJudge picks the backend, judge.gateway_url applies to both.
  • config/judge.go - backend (llm default | decisions) and min_confidence (default 0.7), validated.
  • internal/gateway/supervisor.go - the cli-managed gateway starts with DECISIONS_ENABLED=true when the backend is decisions (container and binary paths).
  • internal/platform/adapters/anthropic_messages.go - delegates CreateDecision like the other SDK methods. Go SDK bumped to v1.45.0, SDK fake regenerated, Decider fake added to mocks:generate.
  • tokenless bumped to v0.12.0 (feat(gateway): serve POST /v1/decisions with scriptable answers tokenless#94), which serves POST /v1/decisions and lists mock/ollama_cloud/clef:27b as a decision model, so INFER_GATEWAY_MOCK=true exercises the whole judge path with no tokens.
  • Tests: decision_judge_test.go (threshold at, above and below, question shape, missing answer fails closed alone, on_error both ways, batch split with summed usage, invalid model, backend selection), decider_test.go (request shape for all three question types, answer parsing, errors, empty decision), config validation cases.
  • Eval: internal/agent/loop/testdata/judge_eval.jsonl holds 30 labelled cases (requested installs, builds, writes and commits vs rm -rf, curl | sh, secret reads, force-push after a bare "continue", prompt injection in arguments, out-of-scope writes). task test:judge-eval with INFER_JUDGE_EVAL_MODEL=provider/model runs them through a gateway and logs accuracy, false approves, p50/p95 latency and tokens per decision.
  • Docs: docs/judge-mode.md gains the "Decision-model judge" section and the new env overrides. examples/working-offline runs the judge on a local ollama/clef: the compose sets DECISIONS_ENABLED=true on the gateway and the judge env on the cli, and the README has the ollama pull clef walkthrough plus the ollama_cloud/clef:27b variant.

Verified in the TUI against the mock

With INFER_GATEWAY_MOCK=true, INFER_JUDGE_BACKEND=decisions, INFER_JUDGE_MODEL=mock/ollama_cloud/clef:27b and a scenarios file carrying a decisions: rule (match: 'rm -rf', probability: 0.05, choice: destructive):

  • Write note.txt in Auto+Judge ran with no prompt (p_approve 0.95).
  • Bash rm -rf ./bin was rejected: rejected by judge: mock/ollama_cloud/clef:27b: rejected by the judge (decisions: p_approve=0.05, risk: destructive, below min_confidence 0.70), and the model read the reason and replied accordingly.

Eval results

Not run in this PR: the harness is in place but running it needs a gateway with an Ollama Cloud key or a local clef. Run INFER_JUDGE_EVAL_MODEL=ollama_cloud/clef:27b task test:judge-eval against your gateway and paste the summary line here. The default min_confidence: 0.7 is the vendor-neutral starting point until those numbers say otherwise.

Deliberate limits

  • Evidence is sent as one text block (the rendered judge prompt), not as structured input_json items. Same information, one code path shared with the LLM judge.
  • No cascade to the LLM judge on low confidence. Add when the eval shows the decision model needs it.
  • Local Ollama decision models are not yet marked in the gateway's model listing, so the gateway relays them unchecked. Fine for the offline example.

Downstream impact

Verification

  • task precommit:run passes (mod tidy, mocks, fmt, lint).
  • go test ./... passes.

…decisions

Adds the decision bounded context (typed predicate, choice and score
questions answered with native probabilities) with one adapter on the
gateway's Decisions API via the Go SDK, and a DecisionJudge behind
judge.yaml backend: decisions that asks one predicate per gated call plus
a risk choice and thresholds p(approve) against min_confidence. The
cli-managed gateway starts with DECISIONS_ENABLED=true when the backend
is selected. The offline example runs the judge on a local ollama clef,
and a labelled eval set runs through any decision model via
task test:judge-eval. Closes #1342.
@edenreich

Copy link
Copy Markdown
Contributor Author

@infer can you review this PR? is it ready for merge? use /ponytail:ponytail /ponytail:ponytail-review /go /go-concurrency /clean-architecture /clean-code /domain-driven-design /cobra-viper

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Model: ollama_cloud/glm-5.3-flash · Action: v0.59.3 · CLI: v0.242.0 · Gateway: v0.63.0 · View Job

Todos

  • Read full diff and commit history
  • Read new decision context (domain, gateway adapter, README)
  • Trace judge call site, verdict events and env bindings
  • Run new unit tests (decision, loop, config)
  • Run e2e decisions-judge test against mock
  • Run lint + gofmt on changed packages
  • File the commit-to [DOCS] tracking ticket on inference-gateway/docs
  • Write review with verdict and findings JSON

Pull Request

#1691

✅ Infer Result: Success

All verification is done - the [DOCS] ticket is filed as inference-gateway/docs#1090. Writing the review now.

What this change does: Adds a second judge backend behind the existing JudgeApprover port. judge.yaml backend: decisions asks a decision model - one predicate question per gated tool call plus one risk class - through the gateway's POST /v1/decisions and thresholds p(approve) at the new judge.min_confidence (default 0.7), so the gate fails closed on a number instead of on parsed prose. Everything after the verdict (batching, on_error, usage accounting, judge_verdict events, escalation, TUI indicator) stays on the shared path, and the new internal/decision bounded context holds the port with the gateway adapter as its only implementation.

Short answer for "is it ready for merge": yes, practically - the code is correct, well tested, and follows the repo's DDD conventions, and the findings below are small. Findings are one docs gap and three nice-to-haves.

What I checked, all passing:

  • New unit tests: internal/decision/..., the DecisionJudge and backend-selection tests in internal/agent/loop, and the judge config tests
  • The tagged e2e: go test -tags e2e ./tests/e2e -run 'TestAgentJudgeDecisionsBackendRejectsOffListCommand|TestAgentJudgeModeRejectsOffListCommand' passes against the tokenless mock (note the e2e package won't compile without -tags e2e)
  • golangci-lint and gofmt over the changed packages: clean
  • Design per the reviewed skills: internal/decision/domain is pure (only context), the port has exactly one adapter plus a counterfeiter fake, depguard needs no new exception, Judge.Validate() runs at startup (config/config.go:1510), and both new env overrides (INFER_JUDGE_BACKEND, INFER_JUDGE_MIN_CONFIDENCE) reach Unmarshal via registerConfigDefaults, which registers every DefaultConfig leaf
  • The verdict path end to end: decideWithJudge → judge.Judge → applyJudgeVerdict is shared and unchanged, rejection reasons keep the escalating agent informed, and the supervisor sets DECISIONS_ENABLED=true in both the container and binary paths with the same pattern as VIDEOS_ENABLED

Must fix: none.

Should fix:

  1. The configuration reference is now stale (docs/configuration-reference.md, not in this diff)
    • What this is: The hand-maintained reference documents every judge.yaml key in three places - the sample at lines 741-759, the key list at 761-778 and the split-file list at 1101 - with the env override list at 776-778.
    • Problem: The PR adds judge.backend, judge.min_confidence, INFER_JUDGE_BACKEND and INFER_JUDGE_MIN_CONFIDENCE but does not touch that page, so the reference documents a judge.yaml surface that omits exactly these. No codegen task exists (checked the Taskfile), so it silently drifts.
    • Fix: Add the two keys to the sample and both lists, plus the two env vars to the override list, with the note that system_prompt and max_tokens only apply to the llm backend. About 6 lines.
    • If we skip it: Correctness is unaffected (judge-mode.md documents the backend), but users reading only the reference never discover the new keys.

Nice to have:
2. Misleading batch comment (internal/agent/loop/decision_judge.go:79-81) - What this is: The doc says "asks the decision model once for every action in batch". Problem: That reads as one HTTP request per action, but decide sends one request per batch carrying one predicate per action (the wording is carried over from judge.go:96 where it is equally ambiguous). Fix: One reworded line, suggestion in the inline comment. If we skip it: Harmless - it is a comment.
3. Near-copies that must change together (internal/agent/loop/decision_judge.go:166) - What this is: DecisionJudge.onError duplicates LLMJudge.onError (judge.go:163-170) with only the log prefix different, and the model checks in Judge plus the judgeBatch scaffolding repeat judge.go:78-116. Problem: The "judge unavailable: ..." reason format feeds the escalation path and tests, so a future format change must be applied twice and will eventually be applied once. Fix: Extract one shared helper in judge.go (for example onErrorVerdict(id string, err error, onError string) agentdomain.JudgeVerdict) and delete both copies. If we skip it: Two occurrences is manageable, this is a cheap cleanup.
4. Unused question-type surface (internal/decision/domain/decision.go:14) - What this is: Score, Level(s), Answer.Score, Answer.Confidence and Answer.Probabilities are declared, built and parsed, but no production code sends a score question or reads them - the judge asks only predicates and the risk choice. Problem: The README names future consumers (routing, triage), so this may be deliberate, but today it is read-and-take-no-action API surface that still needs maintaining. Fix: Ship without the score surface and add it with the first real consumer - about 30 lines less. If we skip it: No behavior risk, just weight.

Pre-merge note (not a code finding): the eval has not been run against a real decision model - the PR body says so itself. The backend is opt-in, default on_error denies, and the threshold is configurable, so this does not block. Pasting the summary line from INFER_JUDGE_EVAL_MODEL=ollama_cloud/clef:27b task test:judge-eval would settle the one open calibration question, namely whether 0.7 is the right default.

Downstream: the PR body's promised [DOCS] ticket is filed as inference-gateway/docs#1090 (judge mode page, reference, gateway requirement, offline example). The gateway-side work is already tracked in inference-gateway/inference-gateway#831 and #832, so I filed nothing else.

Not this PR but noticed while running the suites: config/auth_test.go TestCredentialsPreferTheEnvironmentOverTheAuthFile fails in this runner environment because a real OLLAMA_CLOUD_API_KEY is exported in the environment and wins over the test fixture (the test pins only OPENAI_API_KEY/ANTHROPIC_API_KEY). Pinning that variable with t.Setenv would make the test independent of the runner.

Verdict: fix 1 first (trivial docs), then ship.
Lean: -30 lines possible (shared onError helper, score question surface).
Not checked: the eval against a real decision model (needs a gateway with an ollama_cloud key or a local clef), tokenless v0.12.0 /v1/decisions behavior beyond what the tagged e2e exercises, and a -race run of the new code.

Model: ollama_cloud/glm-5.3-flash · Action: v0.59.3 · CLI: v0.242.0 · Gateway: v0.63.0 · Exit Code: 0 · Duration: 8m 51s

Tokens: 2,930,244 in · 41,970 out · 2,972,214 total (31 requests)

Tool calls: 59 total · 100% success rate

Traces
Session: 1793748123-3b8a2734

session (headless, success)                                                                        8m43s
├── chat ollama_cloud/glm-5.3-flash                                                                11.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.4s
│           ╰── POST [inference-gateway, server]                                                    4.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.4s
├── execute_tool Skill call_xxm8vno4                                                                70µs
├── execute_tool Skill call_o2krgmfz                                                                66µs
├── execute_tool Skill call_eoersotx                                                                66µs
├── execute_tool Skill call_g937karu                                                                45µs
├── chat ollama_cloud/glm-5.3-flash                                                                 1.8s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.8s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.8s
│           ╰── POST [inference-gateway, server]                                                    1.8s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.8s
├── execute_tool Skill call_zfaz5gf4                                                                78µs
├── execute_tool Skill call_16956iam                                                                64µs
├── execute_tool Skill call_ygzlsxa7                                                                64µs
├── execute_tool Skill call_y0z04d41                                                                49µs
├── chat ollama_cloud/glm-5.3-flash                                                                 5.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.1s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        5.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.1s
├── execute_tool TodoWrite call_atlmgvcy                                                            50µs
├── execute_tool Bash call_s9d4gkqq                                                                 10ms
├── chat ollama_cloud/glm-5.3-flash                                                                 1.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.9s
│           ╰── POST [inference-gateway, server]                                                    1.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.9s
├── execute_tool Bash call_wnhdhxm8                                                                 10ms
├── chat ollama_cloud/glm-5.3-flash                                                                58.8s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      58.8s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    58.7s
│           ╰── POST [inference-gateway, server]                                                   58.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                58.7s
├── execute_tool Bash call_8vdocvbr                                                                  5ms
├── execute_tool Grep call_kthm9825                                                                 1.5s
├── execute_tool Read call_1tsfmd69                                                                560µs
├── chat ollama_cloud/glm-5.3-flash                                                                18.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      18.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    18.9s
│           ╰── POST [inference-gateway, server]                                                   18.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                18.9s
├── execute_tool TodoWrite call_1el0dcfd                                                            80µs
├── execute_tool Grep call_ohklqlsd                                                                 85ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.1s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.1s
│           ╰── POST [inference-gateway, server]                                                    2.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.1s
├── execute_tool Grep call_l7zeud37                                                                  8ms
├── execute_tool Read call_ob4sa68x                                                                623µs
├── chat ollama_cloud/glm-5.3-flash                                                                 3.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.9s
│           ╰── POST [inference-gateway, server]                                                    2.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.9s
├── execute_tool Grep call_648434nf                                                                  1ms
├── execute_tool Grep call_jdpk2a34                                                                  1ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.7s
│           ╰── POST [inference-gateway, server]                                                    2.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.7s
├── execute_tool Read call_wmfz5ha0                                                                571µs
├── execute_tool Read call_97v7bmiu                                                                554µs
├── chat ollama_cloud/glm-5.3-flash                                                                 4.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.4s
│           ╰── POST [inference-gateway, server]                                                    4.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.4s
├── execute_tool TodoWrite call_a2vugbs3                                                            56µs
├── execute_tool Bash call_v7ut4p0t                                                                22.7s [error: tool_error]
├── chat ollama_cloud/glm-5.3-flash                                                                 6.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.9s
│           ╰── POST [inference-gateway, server]                                                    6.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.9s
├── execute_tool Read call_ziiju9s6                                                                514µs
├── execute_tool Bash call_wz2zv8kr                                                                406ms
├── chat ollama_cloud/glm-5.3-flash                                                                 3.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.4s
│           ╰── POST [inference-gateway, server]                                                    3.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.4s
├── execute_tool Memory call_on5n0a5g                                                              128µs
├── execute_tool Bash call_su9q1tk0                                                                1m25s
├── chat ollama_cloud/glm-5.3-flash                                                                 2.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.4s
│           ╰── POST [inference-gateway, server]                                                    2.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.4s
├── execute_tool TodoWrite call_u50p7nwh                                                            73µs
├── execute_tool Bash call_y7y8rlfb                                                                  3ms
├── chat ollama_cloud/glm-5.3-flash                                                                 7.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       7.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     7.4s
│           ╰── POST [inference-gateway, server]                                                    7.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 7.4s
├── execute_tool BashOutput call_3e3ccsns                                                           64µs
├── execute_tool Bash call_3c57an7h                                                                 10ms [error: tool_error]
├── chat ollama_cloud/glm-5.3-flash                                                                 2.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.5s
│           ╰── POST [inference-gateway, server]                                                    2.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.5s
├── execute_tool Grep call_w96fo31d                                                                  3ms
├── chat ollama_cloud/glm-5.3-flash                                                                 3.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.0s
│           ╰── POST [inference-gateway, server]                                                    3.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.0s
├── execute_tool Bash call_ymdohygc                                                                35.6s
│   ├── session [infer-action, internal] (headless, success)                                        67ms
│   │   ├── chat openai/gpt-4o [infer-action, client]                                               11ms
│   │   ╰── chat openai/gpt-4o [infer-action, client]                                               10ms
│   ╰── session [infer-action, internal] (headless, success)                                        64ms
│       ├── chat openai/gpt-4o [infer-action, client]                                               10ms
│       ╰── chat openai/gpt-4o [infer-action, client]                                                8ms
├── chat ollama_cloud/glm-5.3-flash                                                                19.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      19.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    19.6s
│           ╰── POST [inference-gateway, server]                                                   19.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                19.6s
├── execute_tool Grep call_8xjf8n76                                                                 1.1s
├── execute_tool Grep call_z8z1n9am                                                                  2ms
├── execute_tool Grep call_611t7sd4                                                                 1.1s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.9s
│           ╰── POST [inference-gateway, server]                                                    1.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.9s
├── execute_tool Read call_7rph2kmc                                                                657µs
├── chat ollama_cloud/glm-5.3-flash                                                                 4.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.5s
│           ╰── POST [inference-gateway, server]                                                    4.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.5s
├── execute_tool Grep call_phkoi4wd                                                                  2ms
├── execute_tool Grep call_bkru9las                                                                  1ms
├── chat ollama_cloud/glm-5.3-flash                                                                20.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      20.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    20.7s
│           ╰── POST [inference-gateway, server]                                                   20.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                20.7s
├── execute_tool Grep call_h8049c4s                                                                  2ms
├── execute_tool Read call_9s6ip3ud                                                                560µs
├── execute_tool Read call_wsnia7st                                                                687µs
├── chat ollama_cloud/glm-5.3-flash                                                                 7.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.9s
│           ╰── POST [inference-gateway, server]                                                    6.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.9s
├── execute_tool Grep call_v9ptzfxl                                                                  2ms
├── execute_tool Grep call_xeyig5u9                                                                  2ms
├── chat ollama_cloud/glm-5.3-flash                                                                15.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      15.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    15.7s
│           ╰── POST [inference-gateway, server]                                                   15.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                15.7s
├── execute_tool Read call_kaxg6x4u                                                                564µs
├── chat ollama_cloud/glm-5.3-flash                                                                 2.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.3s
│           ╰── POST [inference-gateway, server]                                                    2.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.3s
├── execute_tool Grep call_ix83h30j                                                                 1.4s
├── chat ollama_cloud/glm-5.3-flash                                                                 8.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       8.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     8.6s
│           ╰── POST [inference-gateway, server]                                                    8.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 8.6s
├── execute_tool TodoWrite call_rr9r4jyy                                                            61µs
├── chat ollama_cloud/glm-5.3-flash                                                                 6.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.0s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        6.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.0s
├── execute_tool Bash call_783zeohe                                                                23.4s
├── execute_tool Bash call_gisybihp                                                                 79ms
├── chat ollama_cloud/glm-5.3-flash                                                                34.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      34.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    34.2s
│           ╰── POST [inference-gateway, server]                                                   34.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                34.2s
├── execute_tool Bash call_c15gd5p2                                                                844ms
├── chat ollama_cloud/glm-5.3-flash                                                                 4.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.4s
│           ╰── POST [inference-gateway, server]                                                    4.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.4s
├── execute_tool Memory call_d7xuhj28                                                               1.4s
├── execute_tool Bash call_cah0556s                                                                382ms
├── chat ollama_cloud/glm-5.3-flash                                                                14.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      14.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    14.5s
│           ╰── POST [inference-gateway, server]                                                   14.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                14.5s
├── execute_tool Bash call_udp3lb8y                                                                 27ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.8s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.8s
│           ╰── POST [inference-gateway, server]                                                    2.8s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.8s
├── execute_tool TodoWrite call_3j8sdgj0                                                            59µs
├── execute_tool Bash call_iwx2sbf5                                                                 1.3s
├── chat ollama_cloud/glm-5.3-flash                                                                49.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      49.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    49.4s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                       49.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                49.4s
├── execute_tool TodoWrite call_g2yxgvd3                                                            67µs
╰── chat ollama_cloud/glm-5.3-flash                                                                13.7s
    ╰── POST /v1/chat/completions [inference-gateway, server]                                      13.7s
        ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    13.6s
            ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                       13.6s
                ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                13.6s
Stats
Tool Calls

╭────────────┬───────┬───────┬─────────╮
│ Tool       │ Calls │ Fail% │ Avg     │
├────────────┼───────┼───────┼─────────┤
│ Bash       │ 15    │ 13%   │ 11306ms │
│ Grep       │ 15    │ 0%    │ 342ms   │
│ Read       │ 9     │ 0%    │ 586µs   │
│ Skill      │ 8     │ 0%    │ 69µs    │
│ TodoWrite  │ 7     │ 0%    │ 59µs    │
│ Memory     │ 2     │ 0%    │ 676ms   │
│ BashOutput │ 1     │ 0%    │ 56µs    │
╰────────────┴───────┴───────┴─────────╯

Token Usage

╭────────────────────────────┬─────────┬─────────┬────────────┬─────────┬──────╮
│ Model                      │ Prompt  │ Cached  │ Completion │ Total   │ Cost │
├────────────────────────────┼─────────┼─────────┼────────────┼─────────┼──────┤
│ ollama_cloud/glm-5.3-flash │ 2930244 │ 2419200 │ 41970      │ 2972214 │ -    │
╰────────────────────────────┴─────────┴─────────┴────────────┴─────────┴──────╯

Sessions

╭───────────┬──────────┬──────────╮
│ Execution │ Mode     │ Sessions │
├───────────┼──────────┼──────────┤
│ headless  │ headless │ 1        │
╰───────────┴──────────┴──────────╯

Triggered by edenreich · Infer Action · OSS

@inference-gateway-maintainer inference-gateway-maintainer Bot 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.

Full review: #1691 (comment)

Comment thread docs/judge-mode.md Resolved
Comment thread internal/agent/loop/decision_judge.go Resolved
Comment thread internal/agent/loop/decision_judge.go Resolved
Comment thread internal/decision/domain/decision.go Resolved
… question surface

Both judge backends built the same judge-unavailable verdict, so one
onErrorVerdict helper now serves both. The decision context only asks
predicates and one choice, so the score question type, its levels and the
confidence and probabilities answer fields go until a consumer needs them.
The configuration reference documents judge.backend, judge.min_confidence
and their env overrides, and marks the keys that only apply to one backend.
@edenreich
edenreich merged commit 5404ccb into main Nov 4, 2026
14 checks passed
@edenreich
edenreich deleted the feat/issue-1342-decision-judge branch November 4, 2026 11:22
@edenreich edenreich moved this from QA to Done in 2026 Nov 4, 2026
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.243.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Decision domain: typed judge decisions through the gateway's /v1/decisions

1 participant