Files
PaperClipAI/server
Andrii Furmanets dbfcbb532b fix: key dashboard task cards by the native issue id (#15032)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The dashboard draws one task card per issue
> - `selectDashboardRunIds` reads only `contextSnapshot.issueId`
> - A native run stores the task on `nativeIssueId`
> - Older runs store it on `contextSnapshot.taskId`
> - The same task is then drawn as two cards
> - This pull request coalesces the bound issue id, then native issue
id, then context issue id, then task id
> - The benefit is that one task has one dashboard card

## Linked Issues or Issue Description

No open issue covers this. I searched open and closed issues and pull
requests.

**What happened?**

Dashboard task cards ignore the bound and native issue ids.
`selectDashboardRunIds` uses only `contextSnapshot.issueId`. Recovery
already reads `nativeIssueId`, then the context issue id, then `taskId`.
A native or bound run and a context run for the same task both take a
card slot.

**Expected behavior**

Use `coalesce(issueId, nativeIssueId, contextSnapshot.issueId,
contextSnapshot.taskId)` for the card key. Two runs for the same task
collapse to one card.

**Steps to reproduce**

1. Insert two runs for one company with the same `nativeIssueId`.
2. Give them different `contextSnapshot.issueId` values, or omit
`issueId` and set `taskId`.
3. Call `selectDashboardRunIds` with a small limit.
4. Observe that both runs are selected.

**Paperclip version or commit**

master at 215586d127

**Deployment mode**

Local dev (pnpm dev)

## What Changed

- Add `dashboardTaskIssueId`: the bound `issue_id` column first, then
the recovery coalesce order.
- Use it in `selectDashboardRunIds`.
- Add a test that collapses a native pair and a task-id pair, and keeps
a different context issue separate.
- Add a test that collapses a run bound to an issue with a context run
for the same issue.
- After merging master, the live-runs route keeps master's `issueId`
column (the bound `issue_id`), since the run read check uses it.

## Verification

- `pnpm exec vitest run src/__tests__/dashboard-service.test.ts --config
vitest.config.ts` in `server`
- Result: 1 file passed, 6 tests passed

## Risks

- Only card selection changes. The live-runs response and its read check
are unchanged from master.

## Model Used

- No model runtime is part of this change.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
2026-12-04 21:04:45 -08:00
..