Files
PaperClipAI/ui
Nicky LeachandClaude Opus 5.5 79ef767578 fix(ui): hide startup steps too short to name and hold labels long enough to read (#23299)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The task view names each startup stage of a run until the agent
works, for example "Preparing workspace" or "Starting agent".
> - Core and environment plugins report every startup step as it starts,
however short, and the task view decides which labels to show.
> - The view held each label for 500 ms and showed every change at once.
A step of a few milliseconds that started after a longer step appeared
at once and stayed up after it ended. Also, 500 ms is less than the time
most labels take to read.
> - This pull request adds a short show delay, so that steps too short
to name never appear, and holds each shown label for its reading time.
> - The benefit is a status line that changes only for steps that last,
and stays up long enough to read.

## Linked Issues or Issue Description

No public issue exists. Follows #22956, which added the startup stage
labels.

**Subsystem affected**
Task chat UI: the startup stage line of a running turn
(`ui/src/components/task-chat`).

**Problem or motivation**
A startup step that lasts a few milliseconds can show its label for 500
ms after the step ended. For example, a short "Connecting tools" step
inside a long "Starting agent" step changes the line twice. Also, the
500 ms hold is shorter than the time needed to read most labels.

**Proposed solution**
Use the common loading-indicator pattern of a show delay plus a minimum
display time. Base the minimum time on reading time:
- A new stage's label shows only after the stage stays current for 300
ms.
- A shown label stays up for 50 ms per character (20 characters a
second, the usual adult subtitle reading speed), and at least
five-sixths of a second (the usual subtitle minimum).

**Alternatives considered**
- Only a minimum display time (the current behavior). This prevents
flicker, but short steps still show and stay up after they end.
- Hide steps in the reporter. This would put a display rule in each
reporter. Reporters report every step, and the view decides what to
show.

## What Changed

- `useHeldLabel` shows a new label only after it stays current for
`STARTUP_LABEL_SHOW_DELAY_MS` (300 ms). Labels that come and go within
that time never show.
- A shown label stays up for `startupLabelHoldMs(label)`: the greater of
833 ms and 50 ms per character. Today's labels stay up for 0.83 s to
0.95 s.
- The end of startup (no label) has no show delay. The last label is
still held so that it can be read. Agent activity replaces the line as
before.
- The first label shows at once. A task opened during startup can show a
stage that is already old, and `Thinking` in its place would be wrong.
- `DESIGN.md` describes the show delay, the reading-time hold, and the
first label.

## Verification

- `npx vitest run src/components/task-chat/run-startup-stage.test.ts` in
`ui`: 9 tests pass. They cover the first label, the hold per label, the
show delay, a short step inside a longer one, a skip to the latest
stage, a longer hold for a longer label, and the end of startup.
- `npx vitest run src/components/TaskChatThread.test.tsx -t "startup
stage"` in `ui`: the startup stage thread tests pass.
- `pnpm --filter @paperclipai/ui typecheck` passes.
- CI runs the full suite.

## Risks

- Low risk. This changes display timing only.
- Each new label shows 300 ms later than before. A shown label can stay
up for up to about 0.65 s after its step ends, if the step is just
longer than the show delay.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use
(shell, file edits, web research).

## 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)
- [x] 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
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:03:46 -08:00
..
…

@paperclipai/ui

Published static assets for the Paperclip board UI.

What gets published

The npm package contains the production build under dist/. It does not ship the UI source tree or workspace-only dependencies.

Storybook

Storybook config, stories, and fixtures live under ui/storybook/.

pnpm --filter @paperclipai/ui storybook
pnpm --filter @paperclipai/ui build-storybook

Typical use

Install the package, then serve or copy the built files from node_modules/@paperclipai/ui/dist.

Editor dependency identity

Keep the root and workspace overrides for @codemirror/state, @codemirror/view, and @lezer/common aligned. CodeMirror requires shared extension identity, while Lezer parsers and syntax highlighters require shared NodeProp IDs. Multiple Lezer copies can crash code-block highlighting with tags is not iterable. src/lib/codemirror-single-instance.test.ts checks the installed dependency graph and highlights sample code through the editor's real language dependencies. GitHub Actions owns regeneration of pnpm-lock.yaml.