Skip to content

fix(server): the latest task list survives a thread's activity window - #250

Merged
badcuban merged 1 commit into
mainfrom
threadlines/keep-plan-activity
Sep 6, 2026
Merged

fix(server): the latest task list survives a thread's activity window#250
badcuban merged 1 commit into
mainfrom
threadlines/keep-plan-activity

Conversation

@badcuban

@badcuban badcuban commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Clients only receive the newest 500 activities per thread. The task list in the activity popover is itself an activity (turn.plan.updated), so a plan written early in a long, chatty turn could fall out of the window and the popover would show no tasks after a reload, while the live feed still had them. Open approvals and questions were already exempt from the window; the newest plan update now is too.

The retention rule moves into one shared helper, retainThreadActivities in packages/shared, that keeps the recent window plus open prompts and the newest plan update. The projector, both snapshot SQL queries, and the web store use it, so a reload and the live feed agree. The all-threads SQL ranks only the plan rows in a side scan: timed read-only against a 233k-row live activity table, that adds about 0.2 s to the full snapshot query, where a second whole-table window cost 2.7 s.

Known gap, unchanged by this PR: storage maintenance still prunes activity events beyond the cap, so a full projection rebuild can drop these pinned rows. That was already true for open prompts. The comments on the pruner now say so.

Verified with the full typecheck, lint, the shared retention tests, the server snapshot query, projector, and storage maintenance tests, and the web store tests.

Clients only receive the newest 500 activities per thread. The task list in
the activity popover is itself an activity (`turn.plan.updated`), so a plan
written early in a long, chatty turn could fall out of the window and the
popover would show no tasks after a reload, while the live feed still had
them.

Move the retention rule into one shared helper, `retainThreadActivities`,
that keeps the recent window plus open prompts and the newest plan update,
and use it from the projector, both snapshot queries, and the web store so
a reload and the live feed agree. The SQL side ranks only the plan rows in
a side scan; on a 233k-row activity table that adds about 0.2 s to the full
snapshot query instead of the 2.7 s a second whole-table window cost.
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Sep 6, 2026 8:56am UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 6, 2026
@badcuban
badcuban enabled auto-merge September 6, 2026 08:56
@badcuban
badcuban added this pull request to the merge queue Sep 6, 2026
Merged via the queue into main with commit a2b21e8 Sep 6, 2026
16 checks passed
@badcuban
badcuban deleted the threadlines/keep-plan-activity branch September 6, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant