Skip to content

sessions: restore #session references for /troubleshoot in the composer - #343378

Merged
Logan Ramos (lramos15) merged 4 commits into
mainfrom
agents/restore-session-references
Oct 22, 2026
Merged

Logan Ramos (lramos15) merged 4 commits into
mainfrom
agents/restore-session-references

Conversation

@lramos15

@lramos15 Logan Ramos (lramos15) commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Restores #session references in the Agents window composer, which #342683 dropped. Related to #343370, which fixes the other regressions from that PR; the two are independent.

Problem

The previous composer input registered SessionReferenceCompletionHandler. Typing #session listed the Copilot CLI sessions on the same host. Picking one attached a session-reference marker that SessionsManagementService._augmentOptionsForTroubleshoot resolves, so /troubleshoot could read another session's events.jsonl.

#342683 replaced that input with SharedChatInputComposer (a workbench ChatWidget) and deleted the handler. The workbench's own #session completion can't stand in for it:

  • It is skipped for agent-host chats, including Copilot CLI sessions, so those get no #session completions at all.
  • Elsewhere, it references a session resource (URI value), which getSessionReferenceResource doesn't recognise.

So /troubleshoot #session:<title> silently fell back to the current session's log.

Change

  • New SessionReferenceCompletions (sessionReferenceCompletions.ts), registered by SharedChatInputComposer for its own input model only.
    • Like the old handler, it lists the Copilot CLI sessions on the host of the composer's session, newest first, and marks the current one.
    • Accepting an item inserts an inline #session:<title> reference through the chat input's ChatDynamicVariableModel. The input decorates it, removes it when the text is deleted, and turns it into a request attachment whose value is the existing createSessionReferenceVariableEntry marker. _augmentOptionsForTroubleshoot resolves that marker unchanged.
  • Differences from the old handler:
    • It uses the composer's session instead of sessionsService.activeSession.
    • It offers nothing before a session exists, when nothing can be sent anyway.

How to test

  1. In the Agents window, have at least two Copilot CLI sessions.
  2. In a New Session composer, or a new chat in a session, type /troubleshoot #sess. The other sessions on the same host are listed.
  3. Pick one, send, and check that the request names that session's events.jsonl in Session log:.

Validation

  • ./scripts/test.sh --reporter dot --run src/vs/sessions/contrib/chat/test/browser/sessionReferenceCompletions.test.ts --run src/vs/sessions/contrib/chat/test/browser/sharedChatInputComposer.test.ts --run src/vs/sessions/contrib/chat/test/browser/newChatUserInteraction.test.ts --run src/vs/sessions/contrib/chat/test/browser/chatView.test.ts --run src/vs/sessions/contrib/chat/test/browser/newChatWidget.test.ts --run src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts: passed (667 passing, 2 pending).
  • The new tests cover:
    • which sessions are listed;
    • the editor's filtering, so typing #session:<title> still matches;
    • that only the composer's own input model gets completions;
    • that bare #, other variables, other inputs, non-CLI sessions and no session produce nothing;
    • that the reference the request parser builds from an accepted item resolves through getSessionReferenceResource.
  • npm run eslint -- <changed files>: passed.
  • Pre-commit hygiene hook: passed.
  • npx tsc --project ./src/tsconfig.json --noEmit --skipLibCheck: passed. This needed the one-line tabbedModelPicker.fixture.ts fix for the type break currently on main; it's identical to Fix compile break in tabbed model picker fixture #343376, so whichever lands first, the other merges cleanly.
  • Not run:
    • npm run compile: blocked locally by a Copilot SDK version mismatch in node_modules.
    • Manual Agents window testing.

#342683 replaced the Agents window composer input and dropped its
`#session` completions. The workbench completions it now relies on skip
agent-host chats, such as Copilot CLI sessions, and reference a session
resource that the sessions management service does not resolve. So
`/troubleshoot #session:<title>` could no longer point the skill at
another session's event log.

Provide `#session` completions in the shared composer again, listing the
Copilot CLI sessions on the composer session's host. Accepting one adds
an inline reference whose value the troubleshoot augmentation resolves.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 22:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
What changed in this PR

Restores #session completions in the Agents window composer so /troubleshoot can target another Copilot CLI session’s event log by inserting an inline #session:<title> reference.

Changes:

  • Adds SessionReferenceCompletions to provide #session suggestions scoped to the composer’s input model and host.
  • Wires the completions into SharedChatInputComposer.
  • Introduces browser tests covering listing behavior and end-to-end resolution via getSessionReferenceResource.
File Description
src/​vs/​sessions/​contrib/​chat/​browser/​sharedChatInputComposer.ts Registers the new SessionReferenceCompletions for the composer widget.
src/​vs/​sessions/​contrib/​chat/​browser/​sessionReferenceCompletions.ts Implements #session completion provider and insertion via ChatDynamicVariableModel.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​sessionReferenceCompletions.test.ts Adds coverage for listing, scoping, and resolution of inserted session references.

Review effort: Lite

…hem to the input model

- Filter on the inserted `#session:<title>` text. The `#session <title>`
  filter text had no `:`, so the editor hid every suggestion once
  `#session:` was typed.
- Offer completions only for the composer's own input model, not any
  model that shares its resource.

Co-authored-by: Copilot <[email protected]>
#343258 made `autoModelFusion` a boolean while #343324 set it to an
object in this fixture, which breaks compilation on main. Same change as
#343376.

Co-authored-by: Copilot <[email protected]>
@lramos15
Logan Ramos (lramos15) marked this pull request as ready for review October 21, 2026 23:26
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.

3 participants