Add thread ID exclusions to thread/list (#51595)

## Why

Clients displaying a saved manual thread order need to list the remaining threads without repeating those already loaded separately.

## What changed

Add optional `excludedThreadIds` to `thread/list` and the generated protocol bindings. Apply exclusions before the result limit, refilling pages until the requested limit is reached or history is exhausted while preserving existing filters and ordering. Clients must send the same exclusions on each page.

Accept up to 100 entries, counting duplicates toward the bound. Reject invalid IDs or oversized lists with JSON-RPC error `-32602` rather than truncating them. Omitted, null, and empty lists preserve existing behavior.

## Testing

Add integration coverage for page refill across database-only and scan/repair paths, archived threads, sort directions, and project/section scopes. Cover duplicate and unknown IDs, the 100-entry boundary, invalid input, and preservation of section order.

GitOrigin-RevId: e9a884e642ae25d166aff7e275469d1d43179c6c
This commit is contained in:
Brent Traut
2026-10-07 06:07:47 +00:00
committed by copyberry
parent 5a3140176e
commit 1fbe15c962
31 changed files with 369 additions and 3 deletions
@@ -10137,6 +10137,13 @@ class ThreadListParams(BaseModel):
description="Optional cwd filter or filters; when set, only threads whose session cwd exactly matches one of these paths are returned."
),
] = None
excluded_thread_ids: Annotated[
list[str] | None,
Field(
alias="excludedThreadIds",
description="Thread IDs to exclude before applying the result limit. Up to 100 entries; invalid IDs or a larger list are rejected, never truncated. Send the same exclusions on each page. Omitted, null, or empty means no exclusions.",
),
] = None
limit: Annotated[
int | None,
Field(description="Optional page size; defaults to a reasonable server-side value.", ge=0),