🤖 refactor: merge the two supersede loops in drainTerminalAttention

Open Beginner friendly
#7,690 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
73/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Read src/node/services/taskService.ts around TaskService.drainTerminalAttention, then inspect the pending terminal-attention notification tests. After the stack that splits the method into named steps merges, combine the duplicate superseding loops in a helper and add coverage for both missing and archived owner workspaces. Done means both states supersede every pending notification while preserving the race-sensitive behavior.

Written by the indexing model from the issue text.

Description

TaskService.drainTerminalAttention has two identical loops that mark every pending terminal-attention notification superseded: one when the owner workspace no longer exists, one when it is archived (src/node/services/taskService.ts, near the start of the method, at origin/main e70e363471: lines 11483-11485 and 11493-11495).

The stack that splits drainTerminalAttention into named steps keeps both loops inline, on purpose. A shared async helper adds one awaited call, so the code after it runs one microtask later. That stack is move-only, and an earlier split (#7681) showed that one extra microtask can change a race test.

Follow-up: after that stack merges, merge the two loops into one helper in its own PR, with a test that both owner states still supersede every pending notification.


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

Dominant language
TypeScript
Stars
2.1k
Forks
139
Avg merge
3h 35m
Merged PRs (30d)
950

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

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.