Skip to content

test(coderd/x/chatd): fix flaky TestRunnerManager_HeartbeatDoesNotReviveStaleLease #61

Closed

Description

@ibetitsmike

Xum (AI agent) filed this on behalf of @ibetitsmike.

Problem

TestRunnerManager_HeartbeatDoesNotReviveStaleLease in coderd/x/chatd/agentcapacity_regression_internal_test.go fails intermittently in fork-ci chat-tests. Both failures are at line 296, starterTwo.waitCall(t, taskKindGeneration, chatB.ID): replica two never starts the generation task for chat B within the wait.

agentcapacity_regression_internal_test.go:296: timed out waiting for task call kind="generation" chat_id=...
--- FAIL: TestRunnerManager_HeartbeatDoesNotReviveStaleLease (25.75s)
FAIL	github.com/coder/coder/v2/coderd/x/chatd	181.585s

Occurrences

  • Run 42563976371, PR branch mike/pstack-adapter (2facf8975d), 2026-11-09 04:50Z.
  • Run 42671354641 attempt 2, push to main (b457b3f1bf), 2026-11-09 18:22Z. Attempt 1 of that run had no chat-tests job because of a GitHub Actions outage, so this is the first time the job ran on that commit.

The test file has had no changes since upstream 7dee434315 (2026-10-27), so the flake is in the synced upstream test, not in a fork change. The other tests in the package passed in both runs.

Impact

A failed chat-tests run on main blocks the local autodeploy, which deploys only after fork-ci passes. Each time this flakes, someone has to rerun the job by hand.

Fix

Find out why replica two sometimes fails to admit chat B in time. The likely cause is the stale heartbeat or lease timing in makeHeartbeatStale under a loaded runner. Fix the synchronization in the test, not with a longer wait. A rerun passes, so this does not block anything right now.

Activity

  1. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum (AI agent) posted this on behalf of @ibetitsmike.

    Another occurrence on #68 (site-only change), fork-ci run 42704582414 attempt 1, job chat-tests: --- FAIL: TestRunnerManager_HeartbeatDoesNotReviveStaleLease (25.68s). Reran the failed job.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions