Files
PaperClipAI/cli/src
Josh CoxandReview a072b17067 fix(cli): warn when run list stops at the server page cap (#16533)
## Thinking Path
> - Bounding run history gave `GET
/api/companies/:companyId/heartbeat-runs` a default page of 200 runs and
a ceiling of 1,000, with no offset parameter and no truncation signal in
the response.
> - `paperclipai run list` sends `limit` only when `--limit` is passed,
makes one request, and the HTTP client returns only the parsed body. So
the command prints the newest 200 runs and stops, with no notice — and
`--limit 5000` silently stops at 1,000 the same way.
> - The issue's expected behavior is that the command either returns
every run or says that it did not.
> - Returning every run needs server work that is already scoped in open
issue #14958 (an `offset` parameter plus `X-Result-Truncated` /
`X-Total-Count` headers, and a client that surfaces headers). That is
not this PR.
> - What the CLI can do today: tell the truth. State the default and the
ceiling in the help text, and when a page comes back exactly full — the
only truncation sign the current route gives — say on stderr that more
runs may exist.

## Linked Issues

Fixes #16413

Refs #14958

## What Changed

- `cli/src/commands/client/run.ts`: the `run list` `--limit` help now
reads "Maximum runs to return (server default 200, max 1000)", using the
shared `HEARTBEAT_RUN_LIST_DEFAULT_LIMIT` /
`HEARTBEAT_RUN_LIST_MAX_LIMIT` constants so the text cannot drift from
the server values.
- Same file: after printing, when the returned row count reaches the
effective limit (the requested limit clamped to the server ceiling, or
the 200 default), the command prints a notice on stderr: how many runs
are shown, the cap that applied, that more runs may exist, and to raise
`--limit` to see more. stderr keeps `--json` output on stdout clean and
machine-readable.
- Tests in `cli/src/__tests__/run.test.ts`: a full 200-row default page
triggers exactly one stderr notice and sends no `limit` parameter; a
partial page under `--limit 25` stays quiet.

## Verification

- `vitest run src/__tests__/run.test.ts` — 5 of 5 pass, including the
pre-existing run command tests (request shapes unchanged: no `limit` is
sent unless `--limit` is passed).
- Disclosure: the CLI package typecheck did not complete in my sandbox
(the checker process is very slow against the shared package surface
here and was cut off); CI runs the CLI typecheck and is the arbiter. The
change uses two constants that are exported from `@paperclipai/shared`
today and already imported the same way elsewhere.

## Risks

- A company with exactly 200 (or exactly `--limit`) runs gets the notice
even though nothing was hidden. The wording says more runs *may* exist,
which is the strongest claim the current route supports; #14958's
headers will let a later change make it exact.
- This PR deliberately does not page or raise the default page size: the
server bound exists to keep run-history reads cheap, and silently
requesting 1,000 by default would change the command's cost profile for
every user. Full retrieval lands with #14958.

## Model Used

- **Provider / Model ID:** Meta, Muse Spark 1.3
- **Context window:** 1M+ tokens (exact limit not disclosed);
large-repository tasks with long tool transcripts
- **Capabilities:** agentic coding with tool use — file editing, shell
execution, test execution, browser and API access, multi-step planning

## 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)
- [ ] 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
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Signed-off-by: Josh Cox <joshuacox@users.noreply.github.com>
Co-authored-by: Review <review@local>
2026-12-04 23:43:38 -08:00
..