fix: rotate the worked-line verb per turn (CLFY-24) #53

Merged
owlburtoe merged 1 commit from clfy-24-worked-verb-seed into master 2026-07-17 13:55:56 -04:00
Owner

Problem

The inline end-of-turn worked line always rendered the first pool entry — ✻ Cooked for Ns, every turn. Adding custom worked verbs changed nothing.

Root cause: appendWorkedDurationLine (index.ts) called inlineWorkedDurationText(durationMs) with no seed. In formatWorkedLine, Number.isFinite(undefined) is false, so seed fell to 0 and the verb was pool[0]. In append mode (the default) the pool is [...DEFAULT_WORKED_VERBS, ...custom], so index 0 is always the built-in "Cooked" and custom verbs (index 16+) were unreachable. The other worked-line path (index.ts:1333) already passed componentStart as the seed and rotated correctly; only this inline message_end path was affected.

Fix

  • Thread the seed through appendWorkedDurationLine → inlineWorkedDurationText → workedDurationText.
  • Seed at the call site with started — the turn's start timestamp. It is stable across repaints (baked into message.content once at message_end) and varies per turn. Deliberately not duration-derived: the WorkedLineOptions.seed contract notes a duration seed clusters short turns on the same few verbs.
  • Add an optional verbs param so the whole stack is testable without touching settings; export appendWorkedDurationLine.
  • Regression test in test-worked-verbs.ts: asserts the seed is actually used (0→pool[0], 1→pool[1], 5→pool[5 % n]), that a custom verb is reachable in append mode, and that the same start seed is stable across repaints. The existing suites all passed an explicit seed, which is exactly why the seedless production path survived untested.

Test plan

  • bun run test — 15/15 suites green
  • tsc --strict clean
  • Live smoke at release: confirm the verb visibly varies turn-to-turn in a real pi session (the worked line only renders in a live session; the fix only changes verb selection, and the write into message.content already happened pre-change, so risk is low)

Closes CLFY-24

## Problem The inline end-of-turn worked line always rendered the **first** pool entry — `✻ Cooked for Ns`, every turn. Adding custom worked verbs changed nothing. **Root cause:** `appendWorkedDurationLine` (index.ts) called `inlineWorkedDurationText(durationMs)` with **no seed**. In `formatWorkedLine`, `Number.isFinite(undefined)` is false, so `seed` fell to `0` and the verb was `pool[0]`. In append mode (the default) the pool is `[...DEFAULT_WORKED_VERBS, ...custom]`, so index 0 is always the built-in "Cooked" and custom verbs (index 16+) were unreachable. The other worked-line path (index.ts:1333) already passed `componentStart` as the seed and rotated correctly; only this inline `message_end` path was affected. ## Fix - Thread the seed through `appendWorkedDurationLine → inlineWorkedDurationText → workedDurationText`. - Seed at the call site with **`started`** — the turn's start timestamp. It is stable across repaints (baked into `message.content` once at `message_end`) and varies per turn. Deliberately **not** duration-derived: the `WorkedLineOptions.seed` contract notes a duration seed clusters short turns on the same few verbs. - Add an optional `verbs` param so the whole stack is testable without touching settings; export `appendWorkedDurationLine`. - Regression test in `test-worked-verbs.ts`: asserts the seed is actually used (0→pool[0], 1→pool[1], 5→pool[5 % n]), that a custom verb is reachable in append mode, and that the same start seed is stable across repaints. The existing suites all passed an explicit seed, which is exactly why the seedless production path survived untested. ## Test plan - [x] `bun run test` — 15/15 suites green - [x] `tsc --strict` clean - [ ] Live smoke at release: confirm the verb visibly varies turn-to-turn in a real pi session (the worked line only renders in a live session; the fix only changes verb selection, and the write into `message.content` already happened pre-change, so risk is low) Closes CLFY-24
fix: rotate the worked-line verb per turn
All checks were successful
Plane Sync / Close referenced Plane work items (pull_request) Successful in 3s
e0b53ba069
The inline end-of-turn worked line ("✻ Cooked for Ns") always rendered the
first pool entry. appendWorkedDurationLine called inlineWorkedDurationText with
no seed, so formatWorkedLine fell back to seed 0 and picked pool[0] every turn;
custom verbs in append mode (index 16+) were unreachable.

Thread the seed through appendWorkedDurationLine -> inlineWorkedDurationText ->
workedDurationText, seeded at the call site with the turn's start timestamp
(stable across repaints since it is baked into message.content once at
message_end, varies per turn; deliberately not duration-derived, which clusters
short turns). Add an optional verbs param so the path is testable, export
appendWorkedDurationLine, and add a regression test asserting the seed is used
and a custom verb is reachable in append mode.

Closes CLFY-24
owlburtoe merged commit 2b6045d9f2 into master 2026-07-17 13:55:56 -04:00
owlburtoe deleted branch clfy-24-worked-verb-seed 2026-07-17 13:55:56 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
owlburtoe/pi-claudify!53
No description provided.