Skip to content

fix: show logs for tasks killed by runtime without finished_at - #207

Open
npow wants to merge 1 commit into
masterfrom
fix/task-logs-not-shown-for-titus-killed-attempts
Open

fix: show logs for tasks killed by runtime without finished_at#207
npow wants to merge 1 commit into
masterfrom
fix/task-logs-not-shown-for-titus-killed-attempts

Conversation

@npow

@npow npow commented Jun 25, 2026

Copy link
Copy Markdown

Problem

When a Metaflow task is killed by the runtime (e.g. Titus OOM or eviction), the in-container agent is also killed before it can write the attempt-done metadata record. This leaves finished_at = null on the task object returned by the backend.

The UI gates log fetching on isCurrentTaskFinished = !!(task && task.finished_at). With finished_at null, isCurrentTaskFinished is false, paused is true in both useLogData calls, and logs are never fetched — even though they exist in S3.

The logs are there. The UI just never asks for them.

Fix

Treat any terminal task status (completed, failed, unknown) as "finished enough" to fetch logs, regardless of whether finished_at is populated:

// Before
const isCurrentTaskFinished = !!(task && task.finished_at);

// After
const isCurrentTaskFinished = !!(task && (task.finished_at || TERMINAL_TASK_STATUSES.includes(task.status)));

The preload path for live streaming is unchanged — it still only activates for status === 'running'.

Test plan

  • Task killed by Titus (status=failed, finished_at=null): logs now appear in the UI
  • Normal completed task (status=completed, finished_at set): logs still appear (no regression)
  • Running task: live log streaming still works via the preload path
  • Task with unknown status: logs now appear if they exist in S3

🤖 Generated with Claude Code

Tasks killed by Titus (OOM, eviction, etc.) never write the attempt-done
metadata record, leaving finished_at null. The UI gated log fetching on
finished_at being set, so logs were silently never fetched even when they
existed in S3.

Fix: treat any terminal task status (completed, failed, unknown) as
"finished enough" to fetch logs, regardless of finished_at.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant