Skip to content

Add @ file mentions in Session Chat - #678

Merged
ivanfenenko merged 2 commits into
mainfrom
feature/ope-75-file-mentions
Oct 16, 2026
Merged

ivanfenenko merged 2 commits into
mainfrom
feature/ope-75-file-mentions

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Typing @ in Session Chat offers mentionable agents, then project files from the existing find-files search (files only, limit 50) on iOS and Android.
  • Selecting a file inserts @relative/path as its own file mention. Agent mentions stay on their own list, and drafts keep both. Editing or deleting one span shifts the other.
  • On send, v1 adds a file part with url: file://… and source: { type: "file", path, text }. v2 appends { uri, name, mention } after device attachments, without taking an attachment slot. The server resolves the path. File contents are not inlined.
  • Slash commands and skill prompts do not send file-mention parts. An unselected @… token stays plain text. The empty overlay says "No matches". A file-search failure leaves the agent rows in place.

Checks

  • Android: ComposerMentionRoutingTest, MessageDomainAdapterTest, PromptJsonBodyWriterTest, DataStoreComposerDraftStoreTest, and the Session Chat view-model mention tests passed (./gradlew from android/, --offline).
  • iOS: ComposerMentionRoutingTests, MessageDomainAdapterTests, PromptJSONBodyWriterTests, ComposerDraftStoreTests, and SessionChatViewModelTests atSuggestion_selectsProjectFileAndSendsReferenceNotAttachment / atSuggestion_selectInsertsMentionAndSendsAgentParts passed on the iPhone 17 simulator.

Issue

Fixes #413

Risks / Follow-ups

  • Not exercised against a live opencode server. The wire shape follows the server file-part source and the v2 prompt file mention.
  • Folder mentions stay out of scope.
  • The full Android and iOS suites were not re-run locally. CI runs them.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need.

Typing @ offers project files beside agents. A selected file is sent as a server file reference, kept separate from agent mentions and device attachments.

Fixes #413
@linear-code

linear-code Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
OPE-75 @ File Mentions

Let users insert project file references into Session Chat prompts with @, matching opencode TUI/web file autocomplete.

Shell scope:

  • Typing @ in the composer offers fuzzy file matches from the connected project (alongside or in addition to agent mentions)
  • Selecting a file inserts a structured file reference into the prompt payload
  • Respect model/context limits and existing @ agent mention UX

Remaining:

  • ☐ Define product rules vs agent @ mentions (same trigger, disambiguation, or separate mode)
  • ☐ Wire find/file APIs into composer suggestions on iOS and Android
  • ☐ Send structured file parts (or equivalent server contract) on prompt submit
  • ☐ Feature docs under docs/features/at-file-mentions/ when planning starts

Notes:
Placeholder shell. Agent @ mentions already ship via OPE-59; this adds file references.

Review in Linear

@ivanfenenko ivanfenenko left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The composer side is well put together. Mention spans, draft persistence, and the routing tests on both platforms look solid. Two problems on the send path need fixing before this ships. Details inline.

A mention-only prompt now uses the prompt body writer, so the file reference stays on the request. Project file URLs use URLEncoder.encode(String, String), which exists on API 24.
@ivanfenenko
ivanfenenko merged commit 280fb9a into main Oct 16, 2026
@ivanfenenko
ivanfenenko deleted the feature/ope-75-file-mentions branch October 16, 2026 09:21
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.

OPE-75: '@ File Mentions

1 participant