Skip to content

Flaky test: tasks.test.js 'an untagged hold stamps the latest working task' #549

Closed

Description

@Birfy

Seen while verifying #544 (2026-10-20, Node 24.21, box): core/test/tasks.test.js "an untagged hold stamps the latest working task so two tasks do not share one card" failed once in npm run verify and 1 of 6 isolated runs (expected 'working', actual 'blocked' for the first task at line ~401). The PR does not touch tasks or holds.

Likely cause (not confirmed): the two tasks start in the same millisecond, so "latest working task" ties and the hold can stamp the first one.

Expected: the test is deterministic (e.g. an explicit ordering key or a mocked clock). Scope: core/src/host/tasks.js hold stamping and/or the test.

Activity

  1. added
    bugSomething isn't working
    area:automationScheduled tasks and automation
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 20, 2026
  2. Birfy commented on Oct 20, 2026

    @Birfy
    CollaboratorAuthor

    Triage (Birfy, 2026-10-20 22:06 Asia/Shanghai). Test-stability fix, no product behavior. Proposed scope: make core/test/tasks.test.js 'an untagged hold stamps the latest working task' deterministic by giving the two tasks distinct start times in the test (injected clock or an explicit ordering), and only if the tie can also happen in real use, break ties in core/src/host/tasks.js by creation order. Test that fails first: run the case with both tasks forced into the same millisecond. Waiting for the owner's go-ahead (needs-human).

  3. Birfy commented on Oct 20, 2026

    @Birfy
    CollaboratorAuthor

    Owner decision (2026-10-20 22:07 Asia/Shanghai): option a — give the two tasks fixed different start times in the test; if ties can happen in real use, break ties by creation order in tasks.js.

  4. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    and removed
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 20, 2026
  5. self-assigned this
    on Oct 20, 2026
  6. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 20, 2026
  7. Birfy commented on Oct 20, 2026

    @Birfy
    CollaboratorAuthor

    Claimed for this maintenance round. Branch: fix/549-task-order (from main at 7ebe054).

    Plan: make task updatedAt strictly increasing so two starts in the same millisecond still order, add a regression test that freezes the clock (it fails on the current tip), then regenerate patches/ds-bot/ and run the tasks suite, lint and the patch check.

  8. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 21, 2026
  9. added a commit that references this issue on Oct 21, 2026
    db03aa4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:automationScheduled tasks and automationbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions