OpenHands / OpenHands/software-agent-sdk

[Bug]: fork sets title by injecting into state.tags instead of a dedicated field

Open
#4,811 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug memory priority:medium ready-for-dev sdk
Dominant language
Python
Stars
1.1k
Forks
539
Avg merge
1d 19h
Merged PRs (30d)
137

Description

Bug Description

In local_conversation.py (line 876–881), when forking a conversation with a title, the title is set by injecting it into ConversationState.tags as tags["title"] = title. This conflates a display/metadata field with the user-defined tag map and means a forked conversation's tags will always contain a "title" key, which leaks into tag-based queries, observability span attributes, and any downstream consumer that iterates over tags.

# local_conversation.py:876
# Copy title via tags if provided
if title is not None:
    fork_conv._state.tags = {
        **fork_conv._state.tags,
        "title": title,
    }

This appears to be a workaround for ConversationState not having a dedicated title field — the agent server handles fork titles separately via StoredConversation.title.

Expected Behavior

A forked conversation's title is stored in a dedicated field and does not appear as a tag in the conversation's tag map.

Actual Behavior

Forking with a title injects {"title": "<value>"} into state.tags, polluting the tag map with a non-user-defined key. Reproduce with:

python -c "
from openhands.sdk.conversation.impl.local_conversation import LocalConversation
# fork a conversation with a title and inspect state.tags
# tags will contain {'title': 'My Fork'} alongside any user-defined tags
"

Or via the existing test suite:

pytest tests/ -k "fork" -v
Steps to Reproduce
  1. Fork a conversation with a title
  2. Inspect the forked conversation's state.tags
  3. Observe that "title" appears as a key in the tag map alongside user-defined tags
Acceptance Criteria
  • Forking with a title does not inject a "title" key into state.tags
  • The fork title is stored in a dedicated field or passed through a mechanism that does not pollute the tag map
  • Existing fork behavior in the agent server (StoredConversation.title) is unaffected
Additional Context

Discovered while investigating the boundary between ConversationState and StoredConversation (see #4810 and discussion in #proj-agent-server). ConversationState has no title field, which is why this workaround exists. The fix may require deciding where title lives in the standalone SDK context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in local_conversation.py at lines 876–881 and inspect ConversationState and the fork path to determine where a title can live without entering tags. Run pytest tests/ -k "fork" -v, then verify that titled forks preserve user-defined tags and that agent-server StoredConversation.title behavior remains unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.