fix(desktop): handle string display_metadata in async_delegation_complete - #70780
Closed
JonthanaHanh wants to merge 2 commits into
Closed
JonthanaHanh wants to merge 2 commits into
JonthanaHanh wants to merge 2 commits into
Conversation
When an optional-mcps manifest declares transport.type=http with
auth.type=api_key, install_entry() correctly prompts for the key and
saves it to .env, but _build_server_config() only handled the oauth
case — the api_key case produced a bare url entry with no headers,
so every request to the server was unauthenticated (→ 401).
Import and call _bearer_auth_headers(entry.name) from mcp_config.py
to produce the same Authorization: Bearer ${MCP_<NAME>_API_KEY}
template used by the manual 'hermes mcp add --url' path.
Closes NousResearch#70632.
…lete When resuming a session that contains async_delegation_complete messages, display_metadata may arrive from the gateway/database as a JSON string rather than a parsed object. The 'in' operator on a string throws TypeError, crashing session resume. Parse the string to an object before using 'in', with a try/catch fallback for malformed JSON. Closes NousResearch#70635.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When resuming a session containing
async_delegation_completemessages, the desktop app crashes with:The root cause:
display_metadataarrives from the gateway/database as a JSON string rather than a parsed object. The'task_count' in message.display_metadataoperator throws when applied to a string.Fix
Parse
display_metadatato an object before usingin, with atry/catchfallback for malformed JSON:Tests
handles async_delegation_complete with string display_metadata from database— verifies JSON string is parsed and task_count extractedhandles async_delegation_complete with object display_metadata— verifies existing object path still worksCloses #70635.