Cortex icon indicating copy to clipboard operation
Cortex copied to clipboard

Low: expired execution artifacts still offer a Download button that only returns 404

Open dovvnloading opened this issue 3 weeks ago • 0 comments

Impact

Low — expired execution artifacts continue to display an enabled “Download artifact” button. Clicking it predictably results in an unavailable-artifact error instead of explaining that retention has ended.

Code-path evidence

  • ExecutionTaskTray.tsx:439–460 preserves the artifact's expires_at timestamp when parsing the task result.
  • ExecutionTaskTray.tsx:403–429 shows the Download button whenever onDownloadArtifact exists. It never reads expires_at to communicate whether the resource is still available.
  • execution.py:335–357 returns 404 when repository.get_artifact no longer finds an owner-scoped, retained artifact. The repository checks expiry.

Reproduction

  1. Render a terminal task with result {artifact_id:"art-1",mime_type:"image/png",size:100,expires_at:"2020-01-01T00:00:00Z"}.
  2. Actual: the tray still renders an enabled Download artifact button. Clicking it calls the backend, which responds unavailable.
  3. Expected: show “Artifact expired” (with expiry date) and disable or omit Download after expiry, rather than presenting a known-broken action.

Proposed fix / regression

Parse a valid expires_at, show a readable expiry label, and disable download once expired. Recheck on click/time crossing because the tray can stay mounted beyond the deadline. Keep the backend 404 as the ultimate authority. Add component tests for future expiry, past expiry, malformed/missing timestamp, and an artifact expiring while the tray is open.

Reviewed revision: e824fe2dcba0d1be127c9fff165f776186dc37e9. Deterministic view-model gap; UI test not executed.

dovvnloading avatar Nov 09 '26 13:11 dovvnloading