Skip to content

fix(workflows): safely inspect externalized run values - #1070

Open
dovvnloading wants to merge 2 commits into
mainfrom
agent/workflow-externalized-run-values
Open

dovvnloading wants to merge 2 commits into
mainfrom
agent/workflow-externalized-run-values

Conversation

@dovvnloading

Copy link
Copy Markdown
Owner

Summary

Fixes #1035. The detached run journal returns references for large text, JSON and table values rather than the inline fields the inspector previously assumed were present. The inspector now recognizes that storage representation, shows the kind and size without trying to render missing fields, and lets the user explicitly download the original typed JSON envelope.

What Changed

  • Model the actual journal value union separately from the generated inline workflow contract; keep file and image values with their existing inline asset metadata.
  • Use the same handling for result, input and step-output blocks. Show a bounded summary and a download button only for externalized structured values.
  • Download exact bytes through the existing workspace/run-scoped, capability-authenticated asset route, which checks run membership and content integrity. Verify reference metadata and byte length; surface unavailable/corrupt asset errors locally, support retry, cancel downloads on unmount and prevent duplicate requests.
  • Keep polling, approval, and Save result as graph behavior unchanged. Never hydrate large values on poll or disclosure expansion.
  • Add six component regression cases (including the three parameterized kinds) and four real-backend Playwright scenarios covering the 64 KiB text boundary, external text/JSON/table, on-demand download, exact typed payload and continued access to Save result as graph. Component tests additionally simulate missing and wrong-sized assets, invalid refs, retry, authenticated requests and ordinary file metadata.

Why

A completed workflow must remain inspectable regardless of how the backend stores its values. Keeping externalized values as references avoids recreating large inline responses on each poll. The explicit download preserves original text, scalar types, columns and rows without interpreting the contents as active markup. The downloaded JSON is the typed envelope, not a converted text or CSV export.

Validation

  • Strict isolated TypeScript compilation of the exact committed helper using Node 22 and TypeScript 5.8.3 with minimal generated-type and dependency stubs. Verified the tested helper's Git blob hash matches the committed file (ed9a41c6f3fcc8222c3a5a419b01652ef0a43040).
  • 12/12 isolated Node tests passed: inline text/JSON/table/file/image, byte-exact authenticated downloads of external text/JSON/table, missing assets, wrong size, invalid reference and abort. These exercise the helper with real Response/Blob objects and a stubbed browser download function, not React or a live backend.
  • Reviewed branch comparison: one commit changing only the five intended files. Main advanced by one unrelated chart commit during the work; no overlap.
  • App launches
  • Relevant workflow was exercised manually
  • python -m compileall -q . passes (run from repo root)
  • python -m pytest -q passes (run from repo root)
  • cd web_ui && npm run check passes

Local checkout is blocked: git ls-remote https://github.com/dovvnloading/Graphlink.git HEAD fails because github.com cannot be resolved. The component and Playwright tests are added but have not run locally; full CI and browser review remain required. Focused commands in a configured checkout:

npm --prefix web_ui run test -- src/app/chrome/WorkflowRunsPanel.test.tsx
npm --prefix web_ui run check
npm --prefix web_ui run test:e2e -- e2e/workflow-operator.spec.ts

Manual verification: Run a text-copy workflow with text at and above 64 KiB, then inspect its result, inputs and step outputs; repeat for a large JSON/table value. Confirm only the Download button fetches the full asset, the download preserves the complete payload, missing assets show an error without breaking the inspector, and Save result as graph remains available. Verify keyboard operation and both themes.

UI Notes

  • Screenshots included if the change is visual
  • No screenshots needed

Reuses existing Button and InlineAlert components. Screenshots, keyboard and browser verification are pending.

Additional Context

No backend/schema/dependency changes. This change deliberately provides an explicit download rather than rendering arbitrarily large payloads into the DOM. Missing and corrupt references are simulated in component tests; the real-backend browser tests cover the successful asset route. Draft pending CI and manual review; do not merge until those checks pass.

@dovvnloading
dovvnloading marked this pull request as ready for review November 25, 2026 11:53

@dovvnloading dovvnloading left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Source review complete for 3eeaa09. The stored-value union matches the backend journal contract; results, inputs and step outputs branch before inline rendering. The download uses the run-scoped, capability-authenticated endpoint, checks reference metadata and byte length, does not fetch on disclosure/poll, and handles cancellation and retry. The second commit is a test-only MCP cancellation handoff cleanup, not a production backend change. No blocking defect found in the reviewed implementation.

Verified CI: all four required jobs passed, including compile/Ruff/pytest, build, POSIX checks and frontend schema/type/lint/Vitest/build. The frontend log confirms all 9 WorkflowRunsPanel tests passed (195 test files passed overall). MCP browser checks passed. GitHub reports a clean merge, but main has advanced since the CI base, including adjacent workflow input/editor changes.

Remaining pre-merge validation from the PR description: the general Playwright E2E job was skipped by design (scheduled/manual only, not because of draft status); the four new real-backend scenarios and manual UI/theme verification are therefore unverified. Run CI manually on agent/workflow-externalized-run-values with run_browser_tests=true, ideally after integrating current main, or run the focused workflow-operator.spec.ts suite in a configured checkout. Local checkout is blocked by DNS in this environment, and the available GitHub connection cannot dispatch workflows. Marked ready for review; leaving merge pending rather than treating skipped checks as passes.

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.

bug(workflows): run inspector crashes on externalized text, JSON and table values above 64 KiB

1 participant