Skip to content

Split session artifacts into artifacts and references - #332687

Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
benibenj/agents/artifacts-tool-enhancements
Aug 26, 2026
Merged

Split session artifacts into artifacts and references#332687
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
benibenj/agents/artifacts-tool-enhancements

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

An artifact is something the session produced that is not an ordinary workspace edit: a pull request or issue it opened, a plan file written outside the workspace, another side effect of its work. A reference is something it did not produce but the user should look at because of the task: the pull request or commit that introduced a bug, a relevant page.

The agent now says which it recorded through a mandatory isArtifact flag, so the tools are renamed to add_artifact_or_reference, remove_artifact_or_reference and list_artifacts_and_references, and the per-type createdByThisSession field is gone — being produced by the session is the definition of an artifact. Entries persisted before this change read back as artifacts. Tool calls render "Added artifact" or "Added reference" from the flag; removal takes its wording from what it actually removed.

References get their own pill, always summarized as a count, placed directly after the artifacts pill so the two read as a pair. Only artifacts are promoted into the pull request and issue pills, which poll GitHub, but a reference keeps its link identity so anything those pills already show is offered exactly once.

Along the way

  • The artifacts pill no longer collapses into a lone entry unless it is a file, whose name and themed icon say what it is; every other single artifact stays behind "1 Artifact" so the row keeps a stable shape. alwaysSummarize becomes a ChatPillSingleEntry policy interpreted in one place.
  • Parsing GitHub issue and pull request references out of user messages is removed. It fed the same pills from a second source, which would show a recorded reference twice, and it guessed at intent the agent can now state outright.
  • A uri the client cannot open is rejected when it is recorded, instead of being reported as added and then appearing in no pill at all.
  • Reading persisted artifacts reports what it could not parse, so a corrupt row no longer empties a session's artifacts without a trace.

Notes

  • The new SessionChatPills_ReferenceSingle and SessionChatPills_ArtifactsAndReferences fixtures need a screenshot baseline from CI.
  • One consequence of the compatibility rule, called out deliberately: a pull request persisted before this change with createdByThisSession: false reads back as an artifact and can therefore become the session's main pull request. It only affects sessions that recorded someone else's pull request.

Validation

tsc --noEmit, eslint over every changed file, valid-layers-check, and the affected node and chromium suites all pass.

An artifact is something the session produced that is not an ordinary
workspace edit: a pull request or issue it opened, a plan file written
outside the workspace, another side effect of its work. A reference is
something it did not produce but the user should look at because of the
task: the pull request or commit that introduced a bug, a relevant page.

The agent now says which it recorded through a mandatory `isArtifact`
flag, so the tools are renamed to `add_artifact_or_reference`,
`remove_artifact_or_reference` and `list_artifacts_and_references`, and
the per-type `createdByThisSession` field is gone — being produced by the
session is the definition of an artifact. Entries persisted before this
change read back as artifacts. Tool calls render "Added artifact" or
"Added reference" from the flag; removal takes its wording from what it
actually removed.

References get their own pill, always summarized as a count, placed
directly after the artifacts pill so the two read as a pair. Only
artifacts are promoted into the pull request and issue pills, which poll
GitHub, but a reference keeps its link identity so anything those pills
already show is offered exactly once.

Along the way:

- The artifacts pill no longer collapses into a lone entry unless it is a
  file, whose name and themed icon say what it is; every other single
  artifact stays behind "1 Artifact" so the row keeps a stable shape.
  `alwaysSummarize` becomes a `ChatPillSingleEntry` policy interpreted in
  one place.
- Parsing GitHub issue and pull request references out of user messages is
  removed. It fed the same pills from a second source, which would show a
  recorded reference twice, and it guessed at intent the agent can now
  state outright.
- A `uri` the client cannot open is rejected when it is recorded, instead
  of being reported as added and then appearing in no pill at all.
- Reading persisted artifacts reports what it could not parse, so a
  corrupt row no longer empties a session's artifacts without a trace.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-code-engineering

vs-code-engineering Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ladislau Szomoru (@lszomoru)

Matched files:

  • src/vs/sessions/services/sessions/common/session.ts

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.

Pull request overview

Splits session-produced artifacts from task references across storage, tools, GitHub promotion, and chat pills.

Changes:

  • Adds mandatory isArtifact classification and separate References UI.
  • Renames artifact server tools and removes message-based GitHub reference parsing.
  • Adds persistence diagnostics, URI validation, tests, and fixtures.
Show a summary per file
File Description
sessionChatInputToolbar.fixture.ts Adds artifact/reference fixtures.
chatTurnPills.test.ts Tests single-artifact rendering.
chatTurnPills.ts Configures artifact summary policy.
chatDropdownPill.ts Introduces single-entry policies.
session.ts Adds isArtifact to session entries.
localAgentHostSessionsProvider.test.ts Tests GitHub promotion behavior.
baseAgentHostSessionsProvider.ts Promotes only produced GitHub entries.
agentHostSessionArtifacts.ts Partitions artifacts and references.
sessionChatPills.test.ts Tests References visibility.
sessionArtifacts.test.ts Updates artifact fixtures.
sessionChatPills.ts Registers the References pill kind.
sessionCustomizations.ts Adopts the summary policy enum.
sessionChatInputToolbar.ts Adds and positions References.
sessionArtifacts.ts Builds separate artifact/reference sections.
chatContributions.test.ts Removes obsolete parsing tests.
artifactServerTools.test.ts Tests renamed tool displays.
agentSideEffects.test.ts Removes reference-parsing coverage.
agentHostPullRequestOperationProvider.test.ts Updates Git service mock.
agentHostMergeOperationProvider.test.ts Updates Git service mock.
agentHostGitStateService.test.ts Removes message parsing tests.
agentHostContributions.test.ts Updates Git service mock.
agentHostChangesetOperationService.test.ts Updates Git service mock.
agentHostChangesetCoordinator.test.ts Updates Git service mock.
sessionTestHelpers.ts Updates no-op Git service.
sessionArtifacts.test.ts Tests classification and persistence parsing.
githubPullRequestReferences.test.ts Removes deleted parser tests.
githubIssueReferences.test.ts Removes text parser tests.
artifactServerTools.ts Renames and expands artifact tools.
githubReferencesContribution.ts Stops parsing outgoing messages.
agentService.ts Logs persisted artifact corruption.
agentHostGitStateService.ts Removes GitHub text parsing.
sessionState.ts Removes parsed issue-reference state.
sessionArtifacts.ts Persists and parses classification.
sessionArtifactCollection.ts Validates classified tool input.
serverToolNames.ts Renames artifact tool identifiers.
githubPullRequestReferences.ts Deletes the PR text parser.
githubIssueReferences.ts Retains URL-only issue parsing.
agentHostGitStateService.ts Removes reference attachment API.

Review details

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

src/vs/platform/agentHost/common/sessionArtifacts.ts:155

  • readSessionArtifacts accepts rows that lack their kind-specific payload (for example, a file without uri or a pull request without link). Such a row makes dropped remain zero here, then toSessionArtifact silently removes it on the client, so the new corruption warning still misses malformed persisted entries. Validate the required fields per artifact type before computing dropped.
	const artifacts = readSessionArtifacts({ [SESSION_META_ARTIFACTS_KEY]: raw });
	return { artifacts, dropped: raw.length - artifacts.length };
  • Files reviewed: 38/38 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread src/vs/platform/agentHost/common/sessionArtifacts.ts Outdated
Comment thread src/vs/platform/agentHost/common/sessionArtifactCollection.ts
Comment thread src/vs/platform/agentHost/common/serverToolNames.ts
Comment thread src/vs/sessions/services/sessions/common/session.ts
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 79ee2233 Current: ae280e32

Changed (2)

sessions/sessionChatInputToolbar/SessionChatPills_ArtifactSinglePullRequest/Dark
Before After
before after
sessions/sessionChatInputToolbar/SessionChatPills_ArtifactSinglePullRequest/Light
Before After
before after

Added (4)

sessions/sessionChatInputToolbar/SessionChatPills_ReferenceSingle/Dark

current

sessions/sessionChatInputToolbar/SessionChatPills_ReferenceSingle/Light

current

sessions/sessionChatInputToolbar/SessionChatPills_ArtifactsAndReferences/Dark

current

sessions/sessionChatInputToolbar/SessionChatPills_ArtifactsAndReferences/Light

current

- `isArtifact` accepts only a boolean, with an absent field as the sole
  legacy default. A malformed value such as `"false"` or `null` no longer
  reads back as an artifact; the entry is rejected and counted among the
  dropped rows the caller warns about.
- A recorded `uri` is validated by the client's own strict `URI.parse`
  rather than a hand-rolled pattern, so the two can no longer disagree.
  The previous check accepted values like `foo/bar:baz`, which the client
  then failed to open, leaving the entry in no pill at all.
- Renamed server tools keep answering to the names they were advertised
  under. `IServerToolGroup` gains `legacyToolNames`, the host translates a
  legacy name before dispatching, and the display path falls back to it
  once no advertised tool matches — so restored history and prompts
  written against `add_artifact` still route and still render. Groups only
  ever see their current names.
- The Sessions and agent host provider specifications now state that
  `ISession.artifacts` carries both categories and that consumers must use
  `isArtifact` to tell them apart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit 27fb212 into main Aug 26, 2026
54 of 55 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/agents/artifacts-tool-enhancements branch August 26, 2026 09:20
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 26, 2026
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.

4 participants