🤖 bug: init replay lease hand-off windows and no init-end for a replaying backend
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
- Domain
- backend, distributed-systems
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):
- Lease hand-off windows. The owner persists "running" in
startInitshortly beforerunBackgroundInittakes theinitlease, and its final status write (WorkspaceServicelogger:void initStateManager.endInit(...)) is not ordered beforewithInitUseLeasereleases the lease. A replay by another backend that probes in either window sees no lease, reads "running" again, and writesstatus: "error". If that write lands after the owner's final write, a successful init is replayed as interrupted from then on. - No completion for a connected replayer. While the owner holds the lease, the other backend replays the record as running. The owner's
init-endevent is process-local, andAgentSessioncallsreplayInit()only on history replay or reconnect, so the other backend's creation card stays "running" until the client reconnects or reloads.
Possible fix
- Hold one record-owner lock (or the
initlease) from before the "running" write until the final status is durable, for example by having the init logger's completion return theendInitpromise andrunBackgroundInitawait it before the release. - 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/xum
-
flake
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
backlog refactor
Difficulty 2/5 Half a day Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
backlog
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
rohitg00/agentmemory#1428 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
boxlite-ai/boxlite#1729 ·
Maintainers usually reply within 1 day
-
detectors enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
SM260845/readme-gen#1 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
angular/angularfire#3774 ·
Maintainers usually reply within 2 days