Skip to content

fix(console): clip long text in list payloads — 4.26 MB → 1.65 MB per load (v0.291.3) - #525

Merged
vikasprogrammer merged 1 commit into
mainfrom
feat/list-payload-slim
Aug 3, 2026
Merged

fix(console): clip long text in list payloads — 4.26 MB → 1.65 MB per load (v0.291.3)#525
vikasprogrammer merged 1 commit into
mainfrom
feat/list-payload-slim

Conversation

@vikasprogrammer

Copy link
Copy Markdown
Owner

Reported: task / session / artifact detail pages take a long time to open (e.g. #/tasks/tsk_aeb1c5579b6589c4).

The detail endpoints were never the problem. Timed on the live instawp box (localhost, so no network noise):

Endpoint Time Size
GET /api/tasks/tsk_aeb1c… 1.7 ms 6.5 KB
GET /api/state 1.9 ms 44 KB
GET /api/tasks 32–51 ms 1.24 MB
GET /api/sessions 75–84 ms 3.02 MB

The detail pages are slow because the SPA loads the lists alongside them. Breaking down where those megabytes go:

  • /api/sessions — 946 rows, and 2.1 MB of the 3.02 MB is the full task prompt of every session
  • /api/tasks — 471 rows, and 887 KB of the 1.24 MB is task body

That's ~4.3 MB of prose per console load that no list view renders.

Fix: clip both fields to LIST_CLIP (240 chars) using the clipText helper already imported in server.ts. That covers every consumer:

  • sessions list uses task in exactly two places — the client-side search haystack, and a line-clamp-2 fallback caption when title is empty;
  • the tasks board never renders body; the description tab reads detail.task.body from GET /api/tasks/:id, which is unchanged and still returns the full text (const t = detail.task);
  • task search is server-side (?q=), so the client needs no haystack.

Verified against the real production payloads (replaying the clip over the actual responses): 4.26 MB → 1.65 MB, −61%/api/sessions 3.02 → 1.16 MB, /api/tasks 1.24 → 0.48 MB.

Checks: typecheck ✅ · build ✅ · test:governance ✅ (151 conformance / 18 tier-A policy / 18 capability registry / 18 idle reaper).

Not in this PR: /api/sessions still returns all 946 rows unpaginated, and the main JS bundle is 1.1 MB. Clipping is the surgical fix; pagination is the structural one.

🤖 Generated with Claude Code

… load (v0.291.3)

The slow task/session/artifact detail pages were never slow because of
their own endpoints — GET /api/tasks/:id answers in 1.7 ms. The cost is
the LIST payloads the SPA loads alongside them.

Measured on the live instawp tenant:
  GET /api/sessions  3.02 MB / 946 rows — 2.1 MB of it the full `task`
                     prompt of every session
  GET /api/tasks     1.24 MB / 471 rows — 887 KB of it task `body`

~4.3 MB of prose per console load that no list view renders.

Both now clip those fields to LIST_CLIP (240 chars) via the existing
clipText helper. That covers every consumer: the sessions list uses
`task` only as a client-side search haystack and a line-clamp-2 fallback
caption when `title` is empty; the tasks board never renders `body` at
all (the description tab reads detail.task.body from GET /api/tasks/:id,
which is unchanged and still returns the full text). Task search is
server-side (?q=), so the client needs no haystack.

Verified against the real production payloads: 4.26 MB → 1.65 MB (−61%
on both endpoints). typecheck + build + test:governance (151/18/18/18)
all pass.

Follow-up, not in this PR: /api/sessions still returns all 946 rows
unpaginated — clipping is the surgical fix, pagination is the structural
one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vikasprogrammer
vikasprogrammer merged commit 49142eb into main Aug 3, 2026
1 check passed
@vikasprogrammer
vikasprogrammer deleted the feat/list-payload-slim branch August 3, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant