Skip to content

fix(app): keep job events that arrive while the job list loads - #64966

Merged
jlongster merged 1 commit into
devfrom
fix-job-list-race
Nov 19, 2026
Merged

jlongster merged 1 commit into
devfrom
fix-job-list-race

Conversation

@jlongster

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The session's running-jobs list request could overwrite experimental.job.updated events that arrived while it was in flight: a job that settled came back as running forever, and a job that started was wiped. Events seen during the request are now recorded and applied over the response (mergeJobList). Only the latest request's response applies, and only if its session is still current.

How did you verify your code works?

bun run typecheck:tsc, oxlint, bun run lint:changed, and a new unit test covering both race directions.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

User decisions:
- Fix the race between the job list and job.updated events in the desktop app

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks correct. Events seen while the latest list request is in flight are recorded and applied over its response. A response only applies if it belongs to the latest request and its session is still current, so the two race directions (a job that settled coming back as running, a job that started being wiped) are covered. I checked it by reading the change and running the new unit test (passes) and typecheck:tsc for packages/app (passes). I couldn't reproduce the race end to end in the app.

Public API: unchanged (internal to packages/app).

@jlongster
jlongster merged commit dfc06f7 into dev Nov 19, 2026
11 checks passed
@jlongster
jlongster deleted the fix-job-list-race branch November 19, 2026 19:46
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant