Skip to content

Add a resolution judge on a saved resolution_judge LLM profile - #6962

Merged
enyst merged 2 commits into
mainfrom
claude/project-thread-xwkk9b-resolution-judge
Nov 18, 2026
Merged

enyst merged 2 commits into
mainfrom
claude/project-thread-xwkk9b-resolution-judge

Conversation

@enyst

@enyst enyst commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

AND, why is it env vars? We should use an LLM profile, just like we have e.g. an 'oracle' profile, create it if it doesn't exist, 'resolution_judge', wdyt? and is it separable?


AGENT:

Why

Split out of #6602 (OpenHands Projects), which uses it to auto-resolve conversations. There it was configured by OH_RESOLUTION_* environment variables; this version runs on a named LLM profile instead, like oracle and cleanup. Like cleanup, it has no caller on main yet.

Summary

  • openhands.sdk.conversation.resolution: the judge asks narrow yes/no questions about a turn (RESOLUTION_QUESTIONS) through any DecisionModel. verdict_from_judgments combines them in code into a ResolutionVerdict: resolved, or what the user still owes (answer, review, decide, check, unfinished, unclear). LLMDecisionModel lets a chat LLM answer the same typed questions.
  • resolution_judge(fallback, store, cipher=) loads the saved resolution_judge profile. If there is none, it first saves a copy of fallback (the conversation's own LLM, with secrets, encrypted when a cipher is given). The judge keeps its own timeout and retries.
  • No environment variables and no text heuristics: the model decides.

Issue Number

Closes #6961

How to Test

  • uv run pytest tests/sdk/conversation/test_resolution.py: 22 passed, including two new profile tests (created from the conversation's LLM when missing; an existing profile wins).
  • Live, through a LiteLLM proxy (litellm_proxy/deepseek-v4.1-flash as the conversation LLM, empty profile store):
    profiles: ['resolution_judge.json'] judge model: litellm_proxy/deepseek-v4.1-flash
    answered -> nothing resolved  1.0
    asks -> answer  needs_user 0.05
    review -> review  needs_user 0.01
    reused model: litellm_proxy/deepseek-v4.1-flash
    
    "answered" is a plain answer, "asks" ends on a question to the user, and "review" hands over a PR. The last line shows a second call reusing the saved profile instead of the new fallback.

Video/Screenshots

Not a visual change; output above.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

#6602 carries a copy of this module until it merges.


Generated by Claude Code


🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)

• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 python-node-runtime Link
python-minimal amd64, arm64 python-node-runtime Link
python amd64, arm64 python-node-runtime Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:ac30304-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-ac30304-python \
  ghcr.io/openhands/agent-server:ac30304-python

All tags pushed for this build

ghcr.io/openhands/agent-server:ac30304-golang-amd64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-golang-amd64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-golang-amd64
ghcr.io/openhands/agent-server:ac30304-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:ac30304-golang-arm64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-golang-arm64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-golang-arm64
ghcr.io/openhands/agent-server:ac30304-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:ac30304-java-amd64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-java-amd64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-java-amd64
ghcr.io/openhands/agent-server:ac30304-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:ac30304-java-arm64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-java-arm64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-java-arm64
ghcr.io/openhands/agent-server:ac30304-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:ac30304-python-amd64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-amd64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-amd64
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-amd64
ghcr.io/openhands/agent-server:ac30304-python-arm64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-arm64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-arm64
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-arm64
ghcr.io/openhands/agent-server:ac30304-python-minimal-amd64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-minimal-amd64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-minimal-amd64
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:ac30304-python-minimal-arm64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-minimal-arm64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-minimal-arm64
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:ac30304-python-slim-amd64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-slim-amd64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-slim-amd64
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:ac30304-python-slim-arm64
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-slim-arm64
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-slim-arm64
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:ac30304-golang
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-golang
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-golang
ghcr.io/openhands/agent-server:ac30304-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:ac30304-java
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-java
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-java
ghcr.io/openhands/agent-server:ac30304-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:ac30304-python-minimal
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-minimal
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-minimal
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-minimal
ghcr.io/openhands/agent-server:ac30304-python-slim
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python-slim
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python-slim
ghcr.io/openhands/agent-server:ac30304-python-node-runtime-slim
ghcr.io/openhands/agent-server:ac30304-python
ghcr.io/openhands/agent-server:ac303043476cb235ef0c3b82292c37a9790af6a3-python
ghcr.io/openhands/agent-server:claude-project-thread-xwkk9b-resolution-judge-python
ghcr.io/openhands/agent-server:ac30304-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., ac30304-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., ac30304-python-amd64) are also available if needed

The judge asks narrow yes/no questions about a turn and code combines
them into whether anything is left for the user. Its model is the saved
LLM profile resolution_judge, created on first use as a copy of the
conversation's own LLM, like oracle and cleanup.

Co-authored-by: openhands <openhands@all-hands.dev>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ArwwJH94xGSYwfoyccT4E
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@enyst
enyst requested a review from all-hands-bot November 18, 2026 16:37
@enyst
enyst marked this pull request as ready for review November 18, 2026 16:37
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Agent-server conversation start benchmark

Base main@cdc45fbeb26fb429958ee27015cd3de5d514acfb vs this PR merge 7a69224458, measured in the same job on the same runner, interleaved: 5 server starts per side and scenario. Medians with 95% bootstrap CIs. The LLM is a mock that answers instantly, so this is agent-server overhead only.

base this PR change
Create conversation (warm) 0.132 s [0.122, 0.150] 0.154 s [0.138, 0.167] +16% ≈ same
↳ first agent event 0.193 s [0.169, 0.208] 0.217 s [0.196, 0.225] +12% ≈ same
First create right after server start 0.371 s [0.167, 0.459] 0.345 s [0.139, 0.428] -7% ≈ same
↳ first agent event 0.614 s [0.392, 0.730] 0.602 s [0.322, 0.743] -2% ≈ same
First create 3 s after server start 0.213 s [0.114, 0.335] 0.167 s [0.129, 0.278] -22% ≈ same
↳ first agent event 0.423 s [0.279, 0.651] 0.427 s [0.275, 0.576] +1% ≈ same
Create in a new git worktree (warm, 0.5 s git fetch) 0.729 s [0.693, 0.760] 0.706 s [0.670, 0.722] -3% ≈ same
↳ first agent event 0.787 s [0.758, 0.838] 0.772 s [0.711, 0.781] -2% ≈ same
Worktree creates that stalled the server > 20 ms 1/20 (5%) 1/20 (5%) +0 pts ≈ same
Create with one stdio MCP server (warm, 3 s startup) 1.144 s [1.125, 1.166] 1.144 s [1.125, 1.159] +0% ≈ same
↳ first agent event 3.941 s [3.832, 4.085] 3.881 s [3.834, 3.933] -2% ≈ same
Creates that stalled the server > 20 ms 0/35 (0%) 2/35 (6%) +6 pts ≈ same
Server startup (/alive) 4.972 s [4.606, 5.209] 4.927 s [4.333, 5.501] -1% ≈ same
How this is measured

Each create is a Canvas-shaped POST /api/conversations (agent profile, worktree: true, first message included, so the request waits for agent startup). A side task polls /alive every 20 ms to catch event-loop stalls. Scenarios, each on its own server starts:

  • default: a fresh directory per create, 8 creates per start.
  • pause: the first create waits 3 s after startup, as a user opening the UI would.
  • worktree: every create branches a new worktree from a local repository whose origin answers fetches after 0.5 s.
  • mcp: the agent profile enables one stdio MCP server that starts after 3 s, like an npx/uvx launch.

A timing is flagged when the 95% CIs do not overlap and the medians differ by at least 50 ms, or when a row with at least 8 samples per side moves by at least 150 ms and 25%. A create stalled the server when its slowest /alive took over 20 ms; stall rows are flagged when the share of stalled creates moves by at least 20 points with a Fisher exact p below 0.01. The first-create rows have one sample per server start, so they are flagged only on a clear change. A "↳ first agent event" row times the create above it until the agent's first event arrives on a socket opened after the create returns, as Agent Canvas does, so it includes the connect and replay. Runner: blacksmith-2vcpu-ubuntu-2404-wsjgrdwfbejcx2hw, 176 environment variables. Run it locally with python scripts/agent_server_benchmarks/conversation_start.py --help.

enyst pushed a commit that referenced this pull request Nov 18, 2026
The board no longer guesses from question marks or request words: a
question card asks by construction, and otherwise the resolution judge
says whether the reply waits on the user; the ask is the end of that
reply. The judge runs on the saved resolution_judge LLM profile, created
from the conversation's own LLM, instead of OH_RESOLUTION_* environment
variables. Carries a copy of the judge split (resolution.py, #6962).

Co-authored-by: openhands <openhands@all-hands.dev>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ArwwJH94xGSYwfoyccT4E

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was posted by an AI agent (OpenHands).

Reviewed at head d0578d307115b08da554c3dd6c0b139d44156628 (matches the requested review). Scope gate passes: issue #6961 is open with ready-for-dev and proposes exactly this SDK-side judge; the design follows the existing saved-profile-by-convention pattern (cleanup_profile.py's cleanup name, no caller on main), which the PR description and the issue both acknowledge.

Verification performed on this head:

  • Diff is +713 across two new files only: openhands-sdk/openhands/sdk/conversation/resolution.py and tests/sdk/conversation/test_resolution.py. No existing files touched, so no compatibility or migration surface changes.
  • uv run pytest tests/sdk/conversation/test_resolution.py → 22 passed locally; the full tests/sdk/conversation/ suite also passes (1085 passed).
  • ruff check and ruff format --check clean on both files.
  • The module satisfies the repo's LLM message-construction invariant: LLMDecisionModel.send places a system message before the first user message.
  • Secret handling stays on the documented path: profile creation goes through LLMProfileStore.save(..., include_secrets=True, cipher=cipher) (the store owns redaction/encryption contexts), and the judge copy reuses the fallback LLM's credential fields rather than introducing a parallel redaction mechanism. FileNotFoundError is the store's documented miss error, so the create-if-missing branch is correct.
  • model_copy(update={"usage_id": RESOLUTION_JUDGE_PROFILE_NAME, "num_retries": 0}) gives the judge its own metrics session (usage_id change triggers reset_metrics()) and avoids nested retry loops with DecisionModel's tenacity decorator — the effective behavior (60 s per attempt, 1 retry at the DecisionModel layer, 0 inside the LLM) matches the docstring.
  • verdict_from_judgments thresholds and each owed branch (answer, review, decide, check, unfinished, unclear) are covered by the new parametrized tests, and _parse_llm_answers degrades malformed LLM output to "no" rather than crashing, which is also tested.

No material correctness, security, or compatibility findings. The remaining in-progress CI runs at review time (integration-test, tools-tests, benchmark, cross-tests, docker image builds) cover surfaces this SDK-only module change does not touch; the relevant sdk-tests check already passed on this exact head.

✅ APPROVED

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/conversation
   resolution.py1331192%406–407, 412, 433–440
TOTAL57431926084% 

@enyst
enyst enabled auto-merge (squash) November 18, 2026 16:52
@enyst

enyst commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

tools-tests is red on both runs with TestTmuxPoolRecovery in tests/tools/terminal/test_pool_integration.py (LibTmuxException: no current target after exit 0). This PR only adds resolution.py and its test, so it doesn't touch the terminal tool. This is the known bug #6951, and #6952 has an open fix; once that merges, a re-run here should go green.


Generated by Claude Code

@enyst
enyst merged commit 3784934 into main Nov 18, 2026
48 checks passed
@enyst
enyst deleted the claude/project-thread-xwkk9b-resolution-judge branch November 18, 2026 18:00
@enyst enyst mentioned this pull request Nov 19, 2026
1 of 5 tasks
VascoSch92 added a commit that referenced this pull request Nov 25, 2026
…store

Main gained two profile loads that pass the cipher per call:
LocalConversation.add_model_router_route (#6835) and resolution_judge
(#6962). The conversation's store and the server's store are bound to
their cipher, so both now load and save without naming it.

resolution_judge(cipher=...) was published in 1.63.0. It stays as a
deprecated argument that binds the store, scheduled for removal in 1.70.0.
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.

Resolution judge: decide whether a turn leaves anything for the user

3 participants