Skip to content

feat(acp): forward session title updates via session_info_update - #45536

Closed
tudor-the-conqueror wants to merge 1 commit into
anomalyco:devfrom
tudor-the-conqueror:acp-session-title-updates
Closed

tudor-the-conqueror wants to merge 1 commit into
anomalyco:devfrom
tudor-the-conqueror:acp-session-title-updates

Conversation

@tudor-the-conqueror

Copy link
Copy Markdown

Issue for this PR

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When a session title changes (e.g. the title agent generates a title after the first prompt, or a custom agent.title.prompt config renames it), ACP clients never learn about it. The ACP event subscription in packages/opencode/src/acp/event.ts only handles session.status, permission.asked, and message.part.updated/delta — session.updated events are ignored.

Clients like Zed set a provisional title from the truncated first user message and only replace it when the agent sends a session_info_update notification (stabilized ACP protocol feature; Zed handles it in acp_thread.rs and replaces the provisional title on receipt). Since opencode never sends one, ACP sessions stay mislabeled even though opencode CLI/TUI shows the correct title. Titles are only exposed passively via session/list.

This PR handles session.updated in the ACP event subscription and forwards non-empty title changes for known sessions as session_info_update notifications. Repeated session.updated events with an unchanged title are deduplicated via a per-session map so we do not spam the notification on every session write.

How did you verify your code works?

  • Added unit tests in packages/opencode/test/acp/event.test.ts covering: title forwarded as session_info_update, dedup of unchanged titles, and ignoring unknown sessions / empty titles.
  • bun test test/acp/event.test.ts — 19 pass, 0 fail.
  • bun run typecheck (tsgo) — clean.

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The ACP event subscription did not handle session.updated events, so
title changes (e.g. generated by the title agent after the first
prompt) never reached ACP clients. Clients like Zed fall back to a
provisional title derived from the first user message and only replace
it when the agent sends a session_info_update notification.

Handle session.updated in the ACP event subscription and forward
non-empty title changes for known sessions as session_info_update
notifications, deduplicating repeated events with unchanged titles.
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant