Skip to content

feat(web): render tool evidence and preview session artifacts - #496

Open
SSK988I wants to merge 3 commits into
openpi-dev:mainfrom
SSK988I:codex/web-evidence-artifacts-345
Open

feat(web): render tool evidence and preview session artifacts#496
SSK988I wants to merge 3 commits into
openpi-dev:mainfrom
SSK988I:codex/web-evidence-artifacts-345

Conversation

@SSK988I

@SSK988I SSK988I commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

Closes #345. Tool output is difficult to review as generic text, and local artifact links cannot use ordinary Web navigation to reach authenticated files. Includes the controlled artifact access and revision-following slice requested in the maintainer's comments:

Value

Users can inspect file contents, additions/deletions, test observations and terminal receipts, then open/download a generated report and see its next version after modification. Presentation stays tied to observed tool results rather than a success label.

Approach

  • Add bounded specialized read/write/edit/test/terminal cards with sanitized raw fallback and stable live-tool projections across snapshots and replay. Keep unknown tools on the generic path.
  • Capture write comparisons inside Pi's native file mutation queue using its pluggable operations. Preserve native write schema, cancellation and success behavior; distinguish creation, overwrite and unchanged content. Limit comparison input to 32 KiB / 1000 lines per file and retained diff to 12 KiB / 300 lines. Unavailable comparison does not turn a successful write into a failure.
  • Resolve authenticated local Markdown links through Session/workspace-scoped, read-only artifact handles. Reject out-of-scope paths and symlink/junction traversal; bound reads and grants; keep credentials out of links.
  • Show source, revision, text/Markdown preview and bounded download. Resolve nested links relative to the artifact directory. Poll only while a preview is open, retain explicitly stale content on failure, and release access on close/Session transition. Downloads reject changed revisions.
  • Rebuild tracked Web assets after merging current main. No development document, private Session data, screenshots or logs are included.

Validation

Final merged revision: 943d13d (includes main 0d17f45). Validation is not fully green:

  • bun run check: passes in a clean LF export of the final commit. The Windows working checkout fails format checking on existing CRLF files; no repository-wide line-ending rewrite was made.
  • All frontend .spec.ts files through the repository's Vitest runner: 10 files / 132 tests passed after the merge.
  • bun run test:web:e2e: 11 passed / 1 failed after the merge. The new artifact scenario passes, using real Pi read/write/edit operations and the real Host with fixture model responses. The failing upstream workspace-selection test computes workspaceName with canonicalWorkspace.split("/"), leaving a full backslash-separated Windows path and timing out finding the menu item (tests/web/openpi-web.e2e.ts:805-816). It is unchanged by this PR. Before the upstream merge, all 10 browser tests passed.
  • bun run test: latest parallel Node phase 1370 passed / 2 failed / 9 skipped, then the runner stopped before the serial/frontend phases. Failures were the existing setup integration child-process timeout and detached-workflow settlement timeout. Both files passed isolated earlier. An earlier full run also hung after background-terminal manager assertions completed; owned test processes were stopped and remaining tests run separately. No claim of a complete passing full-suite run.
  • Added protocol, artifact authorization/revision, write creation/overwrite/unchanged/failure/cancellation/concurrency, component, accessibility and browser coverage. Focused write/projection tests passed.
  • User manually confirmed write creation, overwrite, unchanged content and persistence after refresh, plus opening the Markdown report with a space in its filename. Model-driven report updates/download/stale preview paths have automated browser coverage; no paid-provider automated smoke was run.
  • git diff --check: passed.

Impact

  • User-visible: evidence cards and read-only artifact previews/downloads. Images/PDF have download fallback; HTML is text, not executable preview. Downloads are capped at 20 MiB. Shell mutations remain terminal evidence and do not invent file diffs.
  • Model-facing: no new tool name or preference. Web's native-schema write implementation adds bounded result details; its ordinary textual response is preserved.
  • Runtime/lifecycle: in-memory bounded handles, authenticated reads, preview polling cleanup, live-tool cache and native-queue write comparison capture. No external watcher service or file editor.
  • Persisted data/config: new write results contain bounded comparison metadata; old records cannot reconstruct missing before-images. No setup/config migration or document changes relative to main.
  • Compatibility/risks: Pi 0.85.1 APIs; evidence may be unavailable for large/non-text/unreadable/changing files. This does not claim to eliminate all races with external filesystem writers. Existing tests/Windows validation limitations above remain visible for review.

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.

feat(web): add purpose-built renderers for file, diff, test, and terminal evidence

1 participant