Skip to content

[BUG] Flaky restart-persistence E2E: TaskMessagesReadError on ui_messages.json after restart #2078

Closed

Description

@edelauna

Summary

The mocked restart-persistence E2E test failed once in about 100 recent runs. The verify phase could not read ui_messages.json for a task that was in history.

Evidence

  • Run: https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/38998169341 (job 117295222479), PR [Fix] Fork PR review-state labels stay stale until the hourly sweep #2049.
  • Failed step: "Run mocked restart-persistence E2E test".
  • create phase passed in about 1 second, then quit VS Code.
  • verify phase logged:
    [createTaskWithHistoryItem] taskScheduler.schedule failed: TaskMessagesReadError: Failed to read task messages for 01a147e2-1838-74dd-8726-1b9b23e29901 at .../tasks/01a147e2-.../ui_messages.json
  • Stack: readTaskMessages <- Task.resumeTaskFromHistory <- TaskScheduler.schedule.
  • The test then waited until its 30 second timeout.
  • The PR changes only a workflow file and its test. It does not touch task persistence.
  • Of the last 100 runs of "E2E Tests (Mocked)", this is the only one with this error.

Cause (not confirmed)

Leading guess: create quits right after TaskCompleted. The final saveClineMessages write may not be on disk yet.

  • waitForMarkedCompletion checks API conversation history. It does not check ui_messages.json.
  • readFileWithMissingRetry retries a missing file once, after 1 to 10 ms. This does not cover a late write.
  • readTaskMessages stores the real error in originalError only. The log message does not show whether the file was missing, unreadable or half-written.

Proposed work

  1. Include the underlying error code in the TaskMessagesReadError message.
  2. Make the create phase wait until ui_messages.json contains the completion marker before it quits.
  3. Re-check the retry window in readFileWithMissingRetry if step 2 does not remove the flake.

Related

Activity

  1. added a commit that references this issue on Oct 18, 2026
    289538e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions