fix(artifacts): surface workspace-shell artifacts in the Artifacts tab #48

Open
lz wants to merge 1 commit from fix/workspace-artifacts into main
Owner

Problem

A workspace-level session could register artifacts (notify-artifact returned working "Open" links, and they opened fine), but the Artifacts tab showed "Artifacts only available for session scopes (not workspace)."

The inconsistency was frontend-only. The backend already treats the workspace shell as a first-class artifact host:

  • The workspace shell is a real sessions row (kind='workspace_shell'), so it has a sessionId.
  • notify-artifact posts that id to /api/agent/artifacts, which resolves the session regardless of kind and stores the artifact against it.
  • The standalone artifact route (/sessions/<id>/artifacts/<id>) — the "Open" link — works for any session id.

But the Artifacts tab in MainSplit.svelte gated on scope.kind === 'session', and the workspace scope carries no sessionId, so it fell through to the placeholder despite the artifacts existing and being reachable by direct link.

Fix

nexus/src/lib/components/main-page/MainSplit.svelte:

  1. Resolve the workspace shell's session id reactively (api.listSessions, re-run on tick) when the scope is a workspace; null when no shell is open.
  2. Unify both scopes behind an artifactsSessionId derived value and render ArtifactsPanel whenever it's present, {#key}'d on the id so a shell close→reopen (new row) remounts cleanly.
  3. The background toast poller uses the same id, so workspace-shell artifacts raise toasts too.
  4. Accurate placeholder for a workspace with no shell open: "Start the workspace shell to register and view its artifacts." (closing the shell cascade-deletes its artifacts, so there's genuinely nothing to show then).

Verification

  • pnpm typecheck — 0 errors
  • pnpm lint — clean
  • pnpm test — 558 passing

Note

Because closing the workspace shell hard-deletes its session row, its artifacts are cascade-deleted (ON DELETE CASCADE on artifacts.session_id). So workspace-shell artifacts are only visible while the shell is open. Decoupling artifact lifetime from the shell session row would be a separate, larger change.

https://claude.ai/code/session_01HFprh3t4G7vTWfuW6GaZLJ

## Problem A workspace-level session could register artifacts (`notify-artifact` returned working "Open" links, and they opened fine), but the **Artifacts tab** showed *"Artifacts only available for session scopes (not workspace)."* The inconsistency was **frontend-only**. The backend already treats the workspace shell as a first-class artifact host: - The workspace shell is a real `sessions` row (`kind='workspace_shell'`), so it has a `sessionId`. - `notify-artifact` posts that id to `/api/agent/artifacts`, which resolves the session regardless of kind and stores the artifact against it. - The standalone artifact route (`/sessions/<id>/artifacts/<id>`) — the "Open" link — works for any session id. But the Artifacts tab in `MainSplit.svelte` gated on `scope.kind === 'session'`, and the workspace scope carries no `sessionId`, so it fell through to the placeholder despite the artifacts existing and being reachable by direct link. ## Fix `nexus/src/lib/components/main-page/MainSplit.svelte`: 1. Resolve the workspace shell's session id reactively (`api.listSessions`, re-run on `tick`) when the scope is a workspace; `null` when no shell is open. 2. Unify both scopes behind an `artifactsSessionId` derived value and render `ArtifactsPanel` whenever it's present, `{#key}`'d on the id so a shell close→reopen (new row) remounts cleanly. 3. The background toast poller uses the same id, so workspace-shell artifacts raise toasts too. 4. Accurate placeholder for a workspace with no shell open: *"Start the workspace shell to register and view its artifacts."* (closing the shell cascade-deletes its artifacts, so there's genuinely nothing to show then). ## Verification - `pnpm typecheck` — 0 errors - `pnpm lint` — clean - `pnpm test` — 558 passing ## Note Because closing the workspace shell hard-deletes its session row, its artifacts are cascade-deleted (`ON DELETE CASCADE` on `artifacts.session_id`). So workspace-shell artifacts are only visible while the shell is open. Decoupling artifact lifetime from the shell session row would be a separate, larger change. https://claude.ai/code/session_01HFprh3t4G7vTWfuW6GaZLJ
fix(artifacts): surface workspace-shell artifacts in the Artifacts tab
All checks were successful
ci / nexus (pull_request) Successful in 3m32s
ci / images (./nexus, agent-nexus) (pull_request) Successful in 5m9s
ci / images (./worker, agent-nexus-worker, base) (pull_request) Successful in 1m13s
ci / images (PLAYWRIGHT_CLI_VERSION=0.1.13, ./worker, agent-nexus-worker, -playwright0.1.13, playwright) (pull_request) Successful in 1m12s
444d2f596f
The Artifacts tab gated on `scope.kind === 'session'`, so a workspace
scope always fell through to the "only available for session scopes"
placeholder — even though the workspace shell is a real `workspace_shell`
session row that `notify-artifact` registers artifacts against, and those
artifacts were already reachable via the direct `/sessions/<id>/artifacts/<id>`
link. The gap was frontend-only.

MainSplit now resolves the workspace shell's session id (reactively, on
tick) and renders ArtifactsPanel for either scope via a unified
`artifactsSessionId`. The background toast poller uses the same id, so
workspace-shell artifacts raise toasts too. The placeholder is now
accurate: a workspace with no shell open is told to start it (closing the
shell cascade-deletes its artifacts, so there's nothing to show then).

Claude-Session: https://claude.ai/code/session_01HFprh3t4G7vTWfuW6GaZLJ
All checks were successful
ci / nexus (pull_request) Successful in 3m32s
ci / images (./worker, agent-nexus-worker, base) (pull_request) Successful in 1m13s
ci / images (./nexus, agent-nexus) (pull_request) Successful in 5m9s
ci / images (PLAYWRIGHT_CLI_VERSION=0.1.13, ./worker, agent-nexus-worker, -playwright0.1.13, playwright) (pull_request) Successful in 1m12s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/workspace-artifacts:fix/workspace-artifacts
git switch fix/workspace-artifacts

Merge

Merge the changes and update on Forgejo.
git switch main
git merge --no-ff fix/workspace-artifacts
git switch fix/workspace-artifacts
git rebase main
git switch main
git merge --ff-only fix/workspace-artifacts
git switch fix/workspace-artifacts
git rebase main
git switch main
git merge --no-ff fix/workspace-artifacts
git switch main
git merge --squash fix/workspace-artifacts
git switch main
git merge --ff-only fix/workspace-artifacts
git switch main
git merge fix/workspace-artifacts
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lz/agent-nexus!48
No description provided.