Repository navigation
feat(mobile): read artifacts, and open artifacts/… links in chat - #851
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
This review includes 22 billable files and costs up to $5.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 13 minutes for your next included review. View limit details
|
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined panel review (reviewer-opus + reviewer-sol) at f4f4b5bd1f
Verdict: one small should-fix. The Captain may take it as a tracked follow-up instead of blocking merge. There are also two optional observations that don't block. Still pending: device captures and the tester's verdict.
Should-fix (small): the viewer keeps the previous artifact's body when its route params change (found independently by both of us)
In ThreadArtifactsScreen.tsx:64–68, useServerRead keeps any prior ready value whenever the load key changes. It does this for a change of resource too, not only for a refresh.
Failure scenario: ThreadArtifact is the current route, and something updates its params, for example an incoming artifact deep link. React Navigation emits NAVIGATE, and StackRouter reuses the current route of the same name. The header then shows B's path over A's body until B's read settles. If B's read is slow or fails, the person is reading the wrong artifact under B's name.
Ordinary All artifacts → another artifact navigation pushes a new screen, so it doesn't reproduce there.
Fix: keep the old content only for a refresh of the same resource. Show loading when the environment, project or path changes. A test with a deferred read, going from A to B, would pin it.
Optional, not merge blockers (follow-up candidates)
- Chat context menu on an
artifacts/…link. "Open file" correctly routes throughonMarkdownLinkPressto the viewer. But "Save" (onFileContextMenuAction→shareFileChip) and the other workspace-only actions still treat the link as a repository file, so Save fails. Web hides workspace actions for artifacts (workspaceRelativePathis null inChatMarkdowncase 33). Copying the logicalartifacts/…path can still be useful. Either hide the unavailable workspace actions or track a follow-up. This doesn't call for artifact download support. - Links inside a Markdown artifact. The viewer passes
threadId={null}toFileMarkdownPreview. That component (FileMarkdownPreview.tsx:198–216) resolves every file link and pushesNewTaskFile, so anartifacts/…link inside an artifact bypasses J5's resolver and opens a missing workspace file. Web's Artifacts page renders throughChatMarkdown, which opens it as an artifact. Handoffs often cross-link plans, so this is worth a follow-up.
Checked and fine
- Faithful extraction.
artifactPreviewKindmaps one-to-one onto web's old branches (image first, then html, markdown and text when UTF-8, otherwise binary).artifactDataUrlandreadArtifact, which resolves credentials at request time throughexecuteJ5Request, move verbatim. Web's artifact unit and browser tests still pass. - Link resolver. The one
openArtifactLinkcall inThreadFeed.tsxruns after skills and before linked threads, media and file handling, soartifacts/x.pngopens the viewer, not a missing workspace image.artifactPathForMarkdownLinkhandles relative,./and absolute workspace-root forms, and rejectssrc/artifacts/…and external URLs (tested). - Route registration.
j5ThreadArtifactRoutessits beside upstream's thread file routes and uses the same linking prefix and header options. - Project scope.
useThreadSelectionreads the route, so the artifact project is the routed thread's, on the routed environment's prepared connection. - Scope rulings followed. HTML shows as source (no WebView, per the Captain's ruling) and there's no delete. SVG renders through
ThreadMarkdownImageView. - Records. FORK.md case 97 lands both reserved seams in the Mobile seams table, with ledger rows and two
upstreamSeams.test.tsreaches. Case 33's text is updated for the moved import.docs/j5/user/artifacts.mdgets a short "On mobile" note.
Reviewer-run checks
- mobile
src/j5/artifactsandupstreamSeams.test.ts: 27 passed, 2 files - client-runtime
artifacts.test.ts: 18 passed - web
src/j5/artifacts: 20 passed, 4 files - mobile
vp run typecheck: exit 0
Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined panel re-review (reviewer-opus + reviewer-sol) at 81ed39a
Verdict: the should-fix and both optional observations are resolved, with no new findings. The panel approves the source. Still pending: device captures and the tester's verdict.
- Stale body:
serverRead.tsvisibleReadcompares the resource before keeping a ready body. A same-resource refresh keeps it, any other resource shows loading, and a failed read retries as loading.serverRead.test.tscovers the rule. It also runs the hook with deferred reads: A settles, the route moves to B and shows loading, B settles, and a refresh keeps B's body while re-reading. List rows and every artifact link nowStackActions.push, so the viewer route isn't reused for another artifact and Back returns to the previous one. - (1) Chat long-press: an
artifacts/…link offers only "Open artifact" and "Copy path" (artifacts/<path>), with no workspace-file actions. The two calls are on the existingThreadFeed.tsxseam, ahead of the skill and file branches (tested inartifactLinks.test.ts). - (2) Links inside an artifact: the viewer renders its own
SelectableMarkdownText. Itsartifacts/…links and long-press menu go through the same J5 helpers. Other workspace links openThreadFilewith the thread, and external links open in the browser. No new upstream edit was needed. - Records: FORK.md case 97 and three
upstreamSeams.test.tsreaches cover the newThreadFeed.tsxcalls.
Reviewer-run checks
- mobile
src/j5/artifactsandupstreamSeams.test.ts: 35 passed, 3 files (both reviewers) - mobile
vp run typecheck: exit 0 - lint: no errors
Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.
81ed39a to
b54fe6f
Compare
Mobile had no way to read the plans, specs and handoffs agents write, and an `artifacts/…` link in chat opened as a workspace file that isn't there. Two thread-scoped J5 screens land through the reserved Route registration seam: the project's artifact list and a read-only viewer (Markdown, text, images; HTML as source; no delete). The reserved Link resolver seam sends `artifacts/…` links to the viewer. Web's artifact path, preview-kind and HTTP read move to client-runtime so both clients share them. Closes #833 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rtifact never shows the old body A viewer reused for another artifact kept showing the previous body until the new read landed; only a refresh of the same artifact keeps its body now, and links push the viewer instead of reusing it. Long-pressing an artifact link offers Open artifact and Copy path, not workspace-file actions that find nothing, and links inside a Markdown artifact open as artifacts, as on web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b54fe6f to
553fe75
Compare
Problem
Mobile had no way to read artifacts, so the plans, specs and persona handoffs agents write couldn't be read from the phone (gap C6). Tapping an
artifacts/…link in chat opened it as a workspace file, which isn't there, because artifacts live in the server's state and not the repository (C7).Closes #833
What changed
packages/client-runtime/src/j5/artifacts.ts: recognisingartifacts/…paths, the preview revision, the preview kind (image, HTML, Markdown, text, binary), the image data URL, and the HTTP read (readArtifact, given a prepared connection). Web'sartifactPath.tsandartifactPreview.logic.tsand their tests move there, and web's Artifacts page and client now call them, with no change in behaviour.Stack.tsxspreads J5'sj5ThreadArtifactRoutes, two thread-scoped screens:ThreadArtifacts: the project's artifact list, with size and age.ThreadArtifact: a read-only viewer. Markdown renders with upstream'sSelectableMarkdownText. Itsartifacts/…links open the viewer, as on web, and its other links resolve from the workspace root. Text renders monospace. Images render through upstream'sThreadMarkdownImageView(SVG included). HTML shows as source, since a phone has no sandboxed frame we trust, as the Captain agreed. Binary shows "No preview". Pull to refresh; no delete. Opening another artifact shows loading, never the previous body; only a refresh of the same artifact keeps its body on screen.ThreadFeed.tsx,onMarkdownLinkPressmakes one call to J5'sopenArtifactLinkbefore its thread, media and file branches.fileContextMenuandonFileContextMenuActioneach make one call first, so long-pressing an artifact link offers Open artifact and Copy path instead of workspace-file actions such as Save, which would find nothing. Links push the viewer, so going from one artifact to another can come back.navigate("ThreadArtifacts", { environmentId, threadId }).docs/j5/user/artifacts.mdgains a short "On mobile" paragraph.UI changes
Android 16 emulator, 1080×2400, light theme. Both sides use the same isolated test home, where a real Claude Haiku agent wrote the artifacts. Base is
31447c91c6, head isb54fe6fe93. iOS is deferred to Checkpoint 1 on Jackson's iPhone, and no iOS UI has been verified.Tapping
artifacts/plan.mdin chat. Before: a missing workspace file. After: the artifact.The viewer and list are new, so these have no before:
Live testing
Android: pass at
b54fe6fe93, run by the crew's tester (GPT-6 Astra through Codex) with real Claude Haiku 5.5 agents on an isolated test server. Report: project artifacttest-reports/j5code-mobile-wave1b-tester/b54fe6fe93.md.artifacts/plan.mdopened the viewer with the Markdown rendered.artifacts/notes.txtopened that artifact, and Back returned to the plan.handoffs/mobile.md, and opening notes showed the new text.Since that run, the branch was rebased onto trunk (#845, #843, #850, #854) and renumbered to FORK case 98. No code changed, so I didn't re-test.
Not exercised live, and why:
serverRead.test.tscovers that rule with deferred reads.Upstream impact
apps/mobile/src/Stack.tsx: one import and one spread (case 98).apps/mobile/src/features/threads/ThreadFeed.tsx: one import and one call in each of the link press, long-press menu and menu action handlers (case 98).apps/web/src/components/ChatMarkdown.tsx: import path only (case 33's text updated).upstreamSeams.test.tshas a row for each.Checklist
artifactLinks.test.ts(which chat links open an artifact, the push, the long-press menu and its actions),serverRead.test.ts(a deferred read from artifact A to B shows loading, not A's body; a same-artifact refresh keeps it),artifacts.test.ts(path recognition, preview revision and kind, moved from web plus the kind cases), the seams test; web's artifact unit and browser tests pass (4 + 16)FORK.md(case text and file-table row) in this PRBuilt by Claude Opus 5.5 in J5 Code (Claude Code harness).
🤖 Generated with Claude Code