[GH-ISSUE #5636] Secret Plot Run Interval can silently drop an edit committed right after a previous commit #3119

Closed
opened 2026-10-21 05:59:45 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Aug 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5636

Originally assigned to: @kolacheee on GitHub.

What happens

A CI run on PR #5635 (touching nothing near this surface) caught the Secret Plot "Run Interval" field dropping a commit: after a previous value was committed with Enter, the next edit — committed by clicking/tabbing away — never reached the server. The smoke test core-flows.e2e.ts:13575 ("Secret Plot run interval stays editable across repeated commits") polled the chat metadata for 10 seconds and it stayed at the previous value.

The exact sequence from the failed run (each step's expectation is the server-side narrativeDirectorSecretPlotRunInterval read back via GET /api/chats/:id):

  1. fill 3, blur → server reads 3 ✅
  2. fill 11, Enter → server reads 11 ✅
  3. fill 0, blur → expected the clamp to commit 1 — server stayed 11 for the full 10-second poll ❌

So this is not a slow save — the third commit apparently never fired.

Why this looks like a real UI bug, not test timing

The suspicious shape is "an edit typed shortly after an Enter-commit is lost on blur." The likely mechanism: the Enter commit triggers the metadata save and a query invalidation; the Chat Settings drawer re-renders the director card with the refetched state, and if the interval input's node or local draft state is replaced during that refetch, the 0 typed into the old node is gone before blur can commit it — the field silently shows/keeps the last saved value. A real user hits the same window by typing a value, pressing Enter, then immediately correcting it and clicking away: the correction vanishes with no error.

An alternative (or contributing) suspect is the clamp path itself: step 3 is the only step going through invalid-input clamping (0 → 1), so the loss might be specific to "commit an out-of-range value via blur right after a refetch."

Where to look

  • The interval field lives in the director card in packages/client/src/components/chat/ChatSettingsDrawer.tsx (the Run Interval labeled input; narrativeDirectorSecretPlotRunInterval is also referenced from AgentAddSetupFields.tsx).
  • Check how the input's draft state survives a metadata refetch mid-edit, and whether the blur handler commits from the DOM value or from React state that a refetch can clobber.

Try it yourself

pnpm exec playwright test -c playwright.config.ts --project=desktop-chromium -g "Secret Plot run interval stays editable" --retries=0 --repeat-each=10

(It passes most runs — the failure needs the refetch to land inside the type-then-blur window, which CI's slower runners hit more often.) Manual: Roleplay chat → Chat Settings → Agents → Narrative Director → type an interval, press Enter, then immediately type another value and click away; check whether the second value survives a reopen.

Evidence: PR #5635's first matrix run, job desktop-chromium 3/3 (run 33256941753) — failure text and call log in the job log. Related: the sticky-header overlap flake from the same run is tracked in the #5635 PR comments as a wave-3 stabilization candidate; this one is split out because it may be a product bug rather than test noise.

Originally created by @kolacheee on GitHub (Aug 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5636 Originally assigned to: @kolacheee on GitHub. **What happens** A CI run on PR #5635 (touching nothing near this surface) caught the Secret Plot "Run Interval" field dropping a commit: after a previous value was committed with Enter, the next edit — committed by clicking/tabbing away — never reached the server. The smoke test `core-flows.e2e.ts:13575` ("Secret Plot run interval stays editable across repeated commits") polled the chat metadata for 10 seconds and it stayed at the *previous* value. The exact sequence from the failed run (each step's expectation is the server-side `narrativeDirectorSecretPlotRunInterval` read back via `GET /api/chats/:id`): 1. fill `3`, blur → server reads `3` ✅ 2. fill `11`, **Enter** → server reads `11` ✅ 3. fill `0`, blur → expected the clamp to commit `1` — **server stayed `11` for the full 10-second poll** ❌ So this is not a slow save — the third commit apparently never fired. **Why this looks like a real UI bug, not test timing** The suspicious shape is "an edit typed shortly after an Enter-commit is lost on blur." The likely mechanism: the Enter commit triggers the metadata save and a query invalidation; the Chat Settings drawer re-renders the director card with the refetched state, and if the interval input's node or local draft state is replaced during that refetch, the `0` typed into the old node is gone before blur can commit it — the field silently shows/keeps the last saved value. A real user hits the same window by typing a value, pressing Enter, then immediately correcting it and clicking away: the correction vanishes with no error. An alternative (or contributing) suspect is the clamp path itself: step 3 is the only step going through invalid-input clamping (`0` → `1`), so the loss might be specific to "commit an out-of-range value via blur right after a refetch." **Where to look** - The interval field lives in the director card in `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (the `Run Interval` labeled input; `narrativeDirectorSecretPlotRunInterval` is also referenced from `AgentAddSetupFields.tsx`). - Check how the input's draft state survives a metadata refetch mid-edit, and whether the blur handler commits from the DOM value or from React state that a refetch can clobber. **Try it yourself** ```bash pnpm exec playwright test -c playwright.config.ts --project=desktop-chromium -g "Secret Plot run interval stays editable" --retries=0 --repeat-each=10 ``` (It passes most runs — the failure needs the refetch to land inside the type-then-blur window, which CI's slower runners hit more often.) Manual: Roleplay chat → Chat Settings → Agents → Narrative Director → type an interval, press Enter, then immediately type another value and click away; check whether the second value survives a reopen. Evidence: PR #5635's first matrix run, job `desktop-chromium 3/3` (run 33256941753) — failure text and call log in the job log. Related: the sticky-header overlap flake from the same run is tracked in the #5635 PR comments as a wave-3 stabilization candidate; this one is split out because it may be a product bug rather than test noise.
bsakaguchi 2026-10-21 05:59:45 +07:00
  • closed this issue
  • added the
    in-pr
    bug
    labels
Author
Owner

@kolacheee commented on GitHub (Aug 29, 2026):

Taking this one: fix up as draft PR #5640 (kolacheee + Claude agent). Root cause is in the shared DraftNumberInput component, not the Secret Plot field specifically — details in the PR.

<!-- gh-comment-id:5463113750 --> @kolacheee commented on GitHub (Aug 29, 2026): Taking this one: fix up as draft PR #5640 (kolacheee + Claude agent). Root cause is in the shared DraftNumberInput component, not the Secret Plot field specifically — details in the PR.
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#3119
No description provided.