Skip to content

chatd: prove that a busy chat family survives an autodeploy restart #252

Open

Description

@ibetitsmike

Xum created this issue on behalf of @ibetitsmike.

Part of moving the pstack lead ("Pstack General", Xum workspace 8ac7791132) to a Coder Agents chat on this fork.

Risk

Today the lead runs in Xum, outside the server it deploys. As a Coder Agents chat it runs inside that server: each merge to main makes autodeploy restart coderd under the lead and every workstream chat. The lead wrote 168 merge records in five days, so this happens many times a day.

What is known:

  • Autodeploy waits up to 30 minutes for chats in running, interrupting or requires_action, then restarts anyway. A lead family is always busy, so every deploy would wait the full 30 minutes and then cut turns off.
  • After a restart, a chat is picked up again once its heartbeat is older than 30 seconds (coderd/x/chatd/ARCHITECTURE.md, Acquisition loop).
  • Missed interval and cron wake-up slots are never replayed (coderd/x/chatd/fork_wakeups.go:335).
  • A workflow run lives in a chatd goroutine until the durable run journal lands (W12 PR2a, pstack W12: Starlark workflows and saved workflows #226).

What nobody has checked is a whole family across a restart: in-flight tool calls, wait_agent in a parent, wait_for_events watches, queued child messages, subagents that wait for capacity, and background processes in the workspace.

Wanted

  • A test that restarts coderd under a root with a running coordinator and two running workers, and checks that every chat finishes its work with no lost child result and no duplicate spawn.
  • The same check on the daily server through one real autodeploy.
  • A decision on the drain: skip the 30-minute wait for chats that resume safely, or have the lead pause its family before a merge.
  • A fix for each case that loses work.

Acceptance

  • The test passes in fork-ci.
  • One autodeploy runs under a live family of at least four chats, and each chat's transcript shows the turn continued or restarted without a repeated side effect.

Activity

  1. added
    pstack-parity
    followup
    on Nov 12, 2026
  2. ibetitsmike commented on Nov 12, 2026

    @ibetitsmike
    OwnerAuthor

    Xum posted this comment on behalf of @ibetitsmike.

    Tracked in #255.

  3. ibetitsmike commented on Nov 13, 2026

    @ibetitsmike
    OwnerAuthor

    Coder Agents acted on behalf of @ibetitsmike.

    Triage (Coder Agents maintainer, 2026-11-13): ready. A workstream started on this issue. Progress and PRs will be posted here.

  4. ibetitsmike commented on Nov 13, 2026

    @ibetitsmike
    OwnerAuthor

    Coder Agents acted on behalf of @ibetitsmike.

    #279 (TestChatFamilySurvivesRestart) merged as 607a95b. #280 and #282 merge next, one per deploy, after each is brought up to main and gated again.

  5. ibetitsmike commented on Nov 14, 2026

    @ibetitsmike
    OwnerAuthor

    Coder Agents acted on behalf of @ibetitsmike.

    #280 (replay-safe spawn_agent) merged as 5c34d7e. #282 is next after this deploys.

  6. ibetitsmike commented on Nov 14, 2026

    @ibetitsmike
    OwnerAuthor

    Coder Agents acted on behalf of @ibetitsmike.

    #282 (message_agent dedupe) merged as 94caf1e. All three PRs for this issue are now on main: #279 (607a95b), #280 (5c34d7e), #282 (94caf1e).

    Follow-up: #287 (same overlapping-replay race in message_family_chat).

    Drain recommendation from the workstream, for Mike and ops: once 94caf1e is deployed, cut the 30-minute busy-chat drain to a short grace period. #279 shows a busy family survives a restart with nothing lost or duplicated; #280 and #282 remove the known duplicates from replayed spawn_agent and message_agent calls. The drain was about 30 of the 46 minutes of the #281 deploy.

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

    followuppstack-parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions