Repository navigation
Conversation
Auto-titling falls back to `agent.llm` when no `title_llm_profile` is
configured. `ACPAgent.llm` only defaults to the `acp-managed` sentinel, so
a backend that stores an agent LLM keeps that model on the agent while the
conversation runs in the ACP subprocess under its own credentials. The
sentinel guard in `generate_title_from_message` does not match, and the
title call reaches a real provider with no key:
litellm.InternalServerError: OpenAIException - Missing credentials.
Please pass an `api_key` ... or set the `OPENAI_API_KEY` ...
Retried four times per conversation, and since #16686 the failure is also
surfaced to the UI, so ACP users see a credentials error on a backend that
deliberately has no model credentials.
Skip `agent.llm` for ACP agents and fall through to truncation.
`title_llm_profile` still takes precedence, so an ACP deployment that wants
generated titles can configure one.
|
|
🚦 CI is currently failing on this PR's latest commit. Please fix the failing checks before OpenHands reviews it - this is re-checked automatically once you push a new commit. (A maintainer can also request This is an automated check - no AI was used to generate this comment. |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Verdict: targeted fix, correct seam
The change addresses a real defect: auto-titling fell back to agent.llm, but for an ACP agent created from ACPAgentSettings that LLM is attribution-only. ACPAgentSettings.create_agent() (openhands-sdk/openhands/sdk/settings/model.py:1846) copies the settings' llm onto the agent and only the acp_model is propagated — the acp-managed/ACP_SENTINEL_USAGE_ID marker lives on _make_dummy_llm() (acp_agent.py:268), so a settings-built ACP agent's LLM keeps usage_id == "default" (model gpt-5.5 by default). I verified this directly:
settings llm usage_id: default model: gpt-5.5
agent llm usage_id: default model: gpt-5.5
agent_kind: acp
direct ACPAgent usage_id: acp-managed acp-managed acp
That is exactly why the existing sentinel guard in title_utils.py:181 (usage_id == "acp-managed") never fires on the reported host, and why the title call reaches a credential-less provider. Deferring to the public AgentBase.agent_kind property rather than an isinstance check keeps the guard honest for both construction paths (settings-built and direct ACPAgent), and preserves title_llm_profile precedence. Non-ACP behavior is unchanged.
Verification on the checked-out head (9a67db942f70bfacbe52571a526ee7d4fd2dfa21):
uv run pytest tests/agent_server/test_conversation_service.py -q→ 114 passeduv run pytest tests/sdk/conversation/test_generate_title.py -q→ 12 passeduv run ruff check/ruff format --checkon both changed files → clean
The new test test_autotitle_skips_inert_acp_agent_llm asserts llm is None reaches generate_title_from_message and that the stored title is the truncation fallback, which is the right observable.
Non-blocking observation (out of scope for this PR)
The same inert-LLM reachability still exists on the SDK-level explicit path this PR does not touch: LocalConversation.generate_title (local_conversation.py:2937) and RemoteConversation.generate_title (remote_conversation.py:1533) both fall back to self.agent.llm, and generate_title_from_message only skips the usage_id == "acp-managed" sentinel. For a settings-built ACP agent (usage_id == "default"), an explicit conversation.generate_title() would still call the attribution-only model. The agent-server REST route is gone and auto-titling is now covered, so this does not block the PR — but if the intended contract is "an ACP agent's LLM is never invoked for titles," the guard may be worth consolidating at the sentinel-detection layer so every caller inherits it. Flagging for a possible follow-up only.
No blocking findings.
✅ APPROVED
neubig
left a comment
There was a problem hiding this comment.
ACP agent LLM settings are inert for execution and are not a valid implicit title-generation credential source. The agent-kind guard is the correct seam: it preserves explicit title profiles and all non-ACP behavior while avoiding credential heuristics. The regression test covers the resulting truncation path.
AI disclosure: This review was submitted by OpenHands on behalf of @neubig.
|
Thanks @lkshrk for tracking this down. Your repro pointed us to the root cause. #5434 (merged) fixes it at the source. That makes this guard redundant, so I'm closing this PR in favor of #5434. This comment was posted by an AI agent (Claude Code) on behalf of the requesting user. |
Pull request was closed
HUMAN:
Found this on a self-hosted Agent Canvas worker running ACP with Claude Code on
subscription auth: every conversation surfaced a credentials error in the UI while
the conversation and its MCP tools worked normally. Confirmed on that host that the
agent LLM is inert under ACP and nothing should be calling it for titles, and that
title_llm_profilewas unset so the fallback was the only path in play. Theagent-server suite and linters were run locally on the branch, and the new test was
checked to fail with the fix reverted. Not able to run a patched agent-server against
that deployment, since it consumes released images.
AGENT:
Why
Auto-titling falls back to
agent.llmwhen notitle_llm_profileis configured.ACPAgent.llmonly defaults to theacp-managedsentinel (acp_agent.py:1673), so a backend that persists an agent LLM keeps that model on the agent while the conversation itself runs in the ACP subprocess under its own credentials. The sentinel guard ingenerate_title_from_message(title_utils.py:186) matches onusage_id == "acp-managed"and therefore never fires, and the title call reaches a real provider with no key:Four retries per conversation, and since #16686 the failure is published to the frontend as well, so ACP users see a credentials error on a backend that deliberately holds no model credentials. Agent Canvas states the same contract from the other side: for
agent_kind: "acp", "The LLM / condenser settings are inert;mcp_configandacp_command/acp_args/acp_model/acp_serverapply instead."Summary
AutoTitleSubscriberno longer falls back toagent.llmfor an ACP agent, using the existing publicAgentBase.agent_kindproperty rather than anisinstancecheck, so the SDK's agent surface stays the seam.title_llm_profilekeeps precedence, so an ACP deployment that wants generated titles configures one; otherwise titling falls through to truncation, which is where a credential-less agent already ended up after four failed attempts.TestAutoTitle::test_autotitle_skips_inert_acp_agent_llm, which asserts the title path receivesllm=Noneand the stored title comes from truncation.Deliberately not treating any credential-less LLM as unusable. That would need a heuristic for "has a usable key", would silently change behaviour for a misconfigured non-ACP backend that today surfaces a real error, and would hide exactly the class of misconfiguration #16686 set out to make visible. ACP is the case where the contract already says the LLM is inert, so that is where the skip belongs. If you would rather generalize, say so and I will rework it.
Issue Number
Fixes #4867
How to Test
The new test is regression-sensitive: reverting only the
conversation_service.pyhunk and re-running givesReproduced on a self-hosted worker running
openhands-agent-server1.44.0 withagent_kind: "acp",acp_server: "claude-code", subscription auth,title_llm_profile: null, and anactive_agent_profile_idwhose model matches the one named in the error. Every new conversation produces the log above while the conversation and its MCP tools work normally.I could not run a patched agent-server against that deployment: it consumes released images, so the end-to-end evidence here is the failure reproduction plus the unit-level proof rather than a patched round trip.
Type
Notes
One workaround is worth recording as a trap: exporting
OPENAI_API_KEYfor the agent-server does make titling work, but ACP subprocesses inherit the parent environment and the Codex CLI prefersOPENAI_API_KEYwhen present, which can silently switch the main workload from subscription auth to API auth.Linked issue #4867 was originally written free-form and so carried none of the bug-template headings, which is why
Validate PR descriptionfailed here with "Linked issue(s) (#4867) carry neitherready-for-devnor a pre-rollout creation date." It has been restructured onto the template — all 16 fields, a runnable reproduction under### Actual Behavior, and acceptance criteria — and now carriesready-for-dev.