Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

🤖 bug: init replay lease hand-off windows and no init-end for a replaying backend

Open
#4,918 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Start by tracing InitStateManager.replayInit, startInit, runBackgroundInit, withInitUseLease, and the WorkspaceService init logger, then check how AgentSession triggers replay. The fix is complete when lease hand-off windows cannot overwrite a successful final status and a connected replaying backend observes and displays the completed record without requiring reconnect or reload.

Written by the indexing model from the issue text.

Description

Problem

Follow-up from the review of #4917 (#4801 item 3). #4917 makes InitStateManager.replayInit leave a "running" init record alone while any live init use lease exists, and read the record again after the lease probe. Two gaps remain, both older than #4917 (before it, the replaying backend always finalized the record):

  1. Lease hand-off windows. The owner persists "running" in startInit shortly before runBackgroundInit takes the init lease, and its final status write (WorkspaceService logger: void initStateManager.endInit(...)) is not ordered before withInitUseLease releases the lease. A replay by another backend that probes in either window sees no lease, reads "running" again, and writes status: "error". If that write lands after the owner's final write, a successful init is replayed as interrupted from then on.
  2. No completion for a connected replayer. While the owner holds the lease, the other backend replays the record as running. The owner's init-end event is process-local, and AgentSession calls replayInit() only on history replay or reconnect, so the other backend's creation card stays "running" until the client reconnects or reloads.

Possible fix

  1. Hold one record-owner lock (or the init lease) from before the "running" write until the final status is durable, for example by having the init logger's completion return the endInit promise and runBackgroundInit await it before the release.
  2. Have the replaying backend observe the lease's release (or the status file) and replay the final record once.

Refs #4801, #4917


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Dominant language
TypeScript
Stars
2k
Forks
136
Avg merge
8h 34m
Merged PRs (30d)
620

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coder/xum

All issues in coder/xum

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.