fix(console): clip long text in list payloads — 4.26 MB → 1.65 MB per load (v0.291.3) - #525
Merged
Merged
Conversation
… 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>
This was referenced Aug 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
GET /api/tasks/tsk_aeb1c…GET /api/stateGET /api/tasksGET /api/sessionsThe 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 fulltaskprompt of every session/api/tasks— 471 rows, and 887 KB of the 1.24 MB is taskbodyThat's ~4.3 MB of prose per console load that no list view renders.
Fix: clip both fields to
LIST_CLIP(240 chars) using theclipTexthelper already imported inserver.ts. That covers every consumer:taskin exactly two places — the client-side search haystack, and aline-clamp-2fallback caption whentitleis empty;body; the description tab readsdetail.task.bodyfromGET /api/tasks/:id, which is unchanged and still returns the full text (const t = detail.task);?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/sessions3.02 → 1.16 MB,/api/tasks1.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/sessionsstill 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