- CURRENT_TASK.md rolled forward — the CI-recovery task is complete
(PR #150 merged as 87bb20b; backend gate is in required checks).
Active task is now landing PR #153.
- HANDOFF.md rewritten — new resume point is watching CI on the
rebased SHA 1559feb and merging when all three checks are green.
- SESSION_LOG.md gains a 2026-04-26 entry covering the prefill bug
diagnosis, fix, regression test, and the rebase off post-#150 main.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
# CURRENT_TASK.md
|
||||
|
||||
**Task:** Land PR #153 — fix the AssistantChatPage prefill `currentChatRef` bug that silently dropped AI follow-up responses in the task lane.
|
||||
|
||||
**Status:** in-progress (CI running on rebased branch)
|
||||
|
||||
**Definition of Done:**
|
||||
- [ ] PR #153 (`fix/tasklane-prefill-ref`) CI green on the rebased SHA `1559feb`. Backend, frontend, and e2e all pass.
|
||||
- [ ] PR #153 merged into `main`.
|
||||
- [ ] User-visible verification: from the dashboard, type a prefill, answer a subset of task-lane questions, click *Send N of M Responses* — AI follow-up renders.
|
||||
|
||||
**Assumptions:**
|
||||
- Rebasing onto post-#150 main pulls in the workflow fixes (no host-port mapping for postgres, no upload-artifact step), so the prior CI failures on this PR are resolved structurally.
|
||||
- The new e2e regression spec (`frontend/e2e/assistant-chat-prefill.spec.ts`) doesn't depend on Anthropic — it uses `page.route` to stub `/ai-sessions/*/chat` deterministically, so it should be CI-stable.
|
||||
|
||||
**Out of scope (deferred to TODO):**
|
||||
- Hardening the `currentChatRef.current !== sentForChatId` silent-return pattern across `handleSend`, `handleTaskSubmit`, `selectChat`, `refreshFacts`, `refreshActiveFix`, `refreshPreview`. PR #153 fixes the specific symptom; the broader audit is its own task in `TODO.md`.
|
||||
- Promoting `CI / e2e (pull_request)` to required on `main`. Holding off until two consecutive green PR runs (PR #150 was one; PR #153's run will be the second if it passes).
|
||||
|
||||
## Previous task — closed out
|
||||
|
||||
**Task:** Land consolidated CI-recovery PR #150 and lock reliable CI gates on `main`.
|
||||
|
||||
**Status:** in-progress
|
||||
**Status:** complete (2026-04-26).
|
||||
|
||||
**Definition of Done:**
|
||||
- [ ] PR #150 (`fix/ci-workflow-config`) merged. `CI / backend (pull_request)`, `CI / frontend (pull_request)`, and `CI / e2e (pull_request)` show success before merge.
|
||||
- [ ] `CI / backend (pull_request)` added to required status checks on `main` in Gitea branch protection (frontend is already required).
|
||||
- [ ] Optional: `CI / e2e (pull_request)` confirmed clean across at least one PR run and added to required checks.
|
||||
|
||||
**Assumptions:**
|
||||
- The 8-core homelab Gitea Actions runner can support `-n auto` (8 xdist workers). If memory pressure shows up in CI, drop to `-n 4`.
|
||||
- pytest-cov's xdist support continues to handle the coverage merge and `--cov-fail-under=50` check correctly.
|
||||
- The per-worker DB creation in `conftest.py` is idempotent and racing workers on first import won't all try to CREATE DATABASE simultaneously — postgres serializes that, but if it surfaces issues, wrap with an advisory lock.
|
||||
|
||||
**Out of scope:**
|
||||
- Frontend lint warnings (23 remain after #149).
|
||||
- The 23 react-hooks/exhaustive-deps warnings.
|
||||
- RLS test suite (gated behind `RUN_RLS_TESTS=1`; not in default CI).
|
||||
- Per-test transactional rollback (would shave another 30-40% off backend time but is a much bigger refactor — capture in TODO if interested).
|
||||
- PR #150 merged as commit `87bb20b` on `main`. Backend, frontend, and e2e all green on the merge SHA.
|
||||
- `CI / backend (pull_request)` added to required status checks on `main` (alongside the pre-existing `CI / frontend (pull_request)` requirement).
|
||||
- `CI / e2e (pull_request)` left as not-required pending one more green PR run.
|
||||
|
||||
@@ -2,63 +2,54 @@
|
||||
|
||||
# HANDOFF.md
|
||||
|
||||
**Last updated:** 2026-04-25 16:41 EDT
|
||||
**Last updated:** 2026-04-26 03:50 EDT
|
||||
|
||||
**Active task:** Land PR #150 (the consolidated CI-recovery PR), then enable backend and eventually e2e gates on `main`. See [CURRENT_TASK.md](CURRENT_TASK.md).
|
||||
**Active task:** Ship PR #153 — the AssistantChatPage prefill `currentChatRef` bug fix. See [CURRENT_TASK.md](CURRENT_TASK.md).
|
||||
|
||||
**Branch:** `fix/ci-workflow-config` -> PR #150. PRs #151 and #152 were closed and consolidated into this branch.
|
||||
**Branch:** `fix/tasklane-prefill-ref` → PR #153.
|
||||
|
||||
## Current resume point
|
||||
|
||||
Latest PR #150 CI had backend and frontend green, but `CI / e2e (pull_request)` failed on the resume smoke test.
|
||||
PR #150 is merged. Branch `fix/tasklane-prefill-ref` has been rebased onto the new `main` (HEAD `1559feb`) and force-pushed; that pulled in the workflow fixes from #150, so the prior backend port-conflict and frontend upload-artifact failures are gone structurally.
|
||||
|
||||
The failure was not product behavior. Playwright was using:
|
||||
CI was kicked off automatically on the rebased SHA. Watch:
|
||||
|
||||
```ts
|
||||
page.locator('.bg-card').filter({ hasText: tree.name }).first()
|
||||
```
|
||||
- `CI / backend (pull_request)` — should pass now that postgres uses the docker-network DNS name `postgres:5432` (no host port race).
|
||||
- `CI / frontend (pull_request)` — should pass now that the `actions/upload-artifact@v4` step is removed.
|
||||
- `CI / e2e (pull_request)` — runs on its own postgres + builds frontend inline. Includes the new `e2e/assistant-chat-prefill.spec.ts` regression test, which stubs `/ai-sessions/*/chat` with `page.route` and is independent of Anthropic.
|
||||
|
||||
On the session history page this matched the tree filter `<select>` first because the select options contain the same flow name, then the test waited forever for a `Resume` button inside the select.
|
||||
If all three go green, merge #153 into `main`.
|
||||
|
||||
This session fixed that properly by adding stable test IDs to repeated cards and moving e2e tests off `.bg-card` selectors:
|
||||
## What this PR fixes
|
||||
|
||||
- `flow-session-card` in `SessionHistoryPage.tsx`
|
||||
- `tree-card` in `TreeGridView.tsx` and `TreeListView.tsx`
|
||||
- `share-card` in `MySharesPage.tsx`
|
||||
Reported symptom: in a troubleshooting (chat) session, after answering a subset of the task-lane questions and clicking *Send N of M Responses*, no AI response appeared.
|
||||
|
||||
The workflow was also hardened:
|
||||
Root cause: the dashboard prefill effect in `AssistantChatPage` set `activeChatId` after creating a new session but never updated `currentChatRef.current`. The `currentChatRef.current !== sentForChatId` guard inside `handleSend` and `handleTaskSubmit` then bailed silently on every later request and discarded the AI's reply.
|
||||
|
||||
- Postgres service healthchecks now run `pg_isready -U postgres` instead of checking as `root`.
|
||||
- The e2e frontend build now bakes `VITE_API_URL="${PLAYWRIGHT_API_ORIGIN}"`, matching the Playwright backend origin.
|
||||
Fix is a single line: assign `currentChatRef.current = session.session_id` immediately after `setActiveChatId(session.session_id)` in the prefill effect, mirroring `handleNewChat` and `handleResumeNew`.
|
||||
|
||||
## Verification completed
|
||||
|
||||
- `git diff --check`
|
||||
- Confirmed no remaining `.bg-card` selectors in `frontend/e2e/*.ts`.
|
||||
- `docker exec -w /app resolutionflow_frontend npm run build`
|
||||
- Ran migrations and test-user seed in the dev backend container.
|
||||
- Focused Playwright verification in an Actions-like Ubuntu container:
|
||||
- First `e2e/resume.spec.ts` passed.
|
||||
- Then `e2e/history.spec.ts e2e/library.spec.ts e2e/library-start.spec.ts e2e/resume.spec.ts e2e/shares.spec.ts --project=chromium --workers=1` passed: `6 passed (1.3m)`.
|
||||
|
||||
## Immediate next steps
|
||||
|
||||
1. Push the WIP commit from this session to PR #150.
|
||||
2. Watch PR #150 CI on the new SHA. Expected result: backend, frontend, and e2e all green.
|
||||
3. Merge PR #150 when green.
|
||||
4. Enable `CI / backend (pull_request)` as a required status check on `main`.
|
||||
5. After at least one reliable green PR run, consider adding `CI / e2e (pull_request)` as required too.
|
||||
- New regression test `frontend/e2e/assistant-chat-prefill.spec.ts` drives the real dashboard prefill flow against the real backend, stubs `/ai-sessions/*/chat` for deterministic turn-1/turn-2 responses, asserts the second AI message renders. Confirmed it fails on unfixed code at the exact assertion (`Got it — based on your answer…` never appears) and passes once the fix is restored.
|
||||
- `tsc -b` clean. No new lint errors. Adjacent specs (`flowpilot-chat`) still pass.
|
||||
|
||||
## Branch protection on main (current)
|
||||
|
||||
- PR-only merges
|
||||
- `CI / frontend (pull_request)` required
|
||||
- `CI / backend (pull_request)` required (added during PR #150 close-out)
|
||||
- Force-push blocked
|
||||
- No review required (solo)
|
||||
|
||||
## Immediate next steps
|
||||
|
||||
1. Watch PR #153 CI on `1559feb`.
|
||||
2. Merge PR #153 when all three checks are green.
|
||||
3. After merge, decide whether to promote `CI / e2e (pull_request)` to required (would make this two consecutive green PR e2e runs in a row, the threshold from the prior CURRENT_TASK).
|
||||
4. Pick next item from `.ai/TODO.md` — top "Up next" is the `data-testid` audit; the `currentChatRef` silent-return follow-up is in Backlog and is a natural pairing with this fix.
|
||||
|
||||
## Useful breadcrumbs
|
||||
|
||||
- `.gitea/workflows/ci.yml` contains the parallel backend/frontend/e2e workflow.
|
||||
- `backend/scripts/seed_phase9_qa_fixtures.py` pre-bakes Phase 9 QA fixtures.
|
||||
- `.gstack/qa-reports/phase9-20260424-232700/REPORT.md` has the FlowPilot QA report.
|
||||
- Per-worker test DBs accumulate on the Postgres service. Cheap to leave around; cleanup if needed.
|
||||
- Bug fix: [`frontend/src/pages/AssistantChatPage.tsx`](../frontend/src/pages/AssistantChatPage.tsx) around line 258 — the `currentChatRef.current = session.session_id` line in the prefill `sendPrefill` effect.
|
||||
- Regression test: [`frontend/e2e/assistant-chat-prefill.spec.ts`](../frontend/e2e/assistant-chat-prefill.spec.ts).
|
||||
- TODO entry tracking the broader silent-return audit: [`.ai/TODO.md`](TODO.md).
|
||||
|
||||
@@ -12,6 +12,18 @@
|
||||
|
||||
---
|
||||
|
||||
## 2026-04-26 03:50 EDT — Claude Code — Ship AssistantChatPage prefill `currentChatRef` fix; close out PR #150
|
||||
|
||||
- User reported a troubleshooting-session bug: after answering a subset of task-lane questions and clicking *Send N of M Responses*, no AI response appeared. Traced to `AssistantChatPage`: the dashboard prefill effect set `activeChatId` after creating a new chat session but never updated `currentChatRef.current`. The `currentChatRef.current !== sentForChatId` guard in `handleSend` and `handleTaskSubmit` then bailed silently on every later request and discarded the AI's reply. The user message was already pushed to the chat before the await, so the user saw their answers but nothing else.
|
||||
- Fix: one-line addition mirroring `handleNewChat` and `handleResumeNew` — assign `currentChatRef.current = session.session_id` immediately after `setActiveChatId(session.session_id)` in the prefill effect. Branched off `origin/main` as `fix/tasklane-prefill-ref`; PR #153 opened on Gitea.
|
||||
- Authored a Playwright regression test `frontend/e2e/assistant-chat-prefill.spec.ts` that drives the real dashboard prefill flow against the real backend, stubs `/ai-sessions/*/chat` with `page.route` for deterministic turn-1/turn-2 responses, and asserts the second AI message renders. Confirmed the test fails on unfixed code at the exact assertion (`Got it — based on your answer…` never appears) and passes once the fix is restored.
|
||||
- Verified locally inside `mcr.microsoft.com/playwright:v1.58.2-noble` against the running dev stack: new spec passes, adjacent `flowpilot-chat` spec still passes, `tsc -b` clean. `resume.spec` and `history.spec` failures observed are pre-existing real-backend fixture collisions, unrelated to this change.
|
||||
- First CI run on PR #153 failed on infrastructure issues already addressed by PR #150: backend hit `Bind for 0.0.0.0:5432 failed: port is already allocated`, frontend hit `actions/upload-artifact@v4 not supported on GHES`. PR #150 was already merged (commit `87bb20b` on `main`). Rebased `fix/tasklane-prefill-ref` onto new `main` (force-push `1a8cb06` → `1559feb`), resolved a `.ai/TODO.md` conflict by keeping both backlog item sets, kicked off CI on the rebased SHA.
|
||||
- Confirmed `CI / backend (pull_request)` is now in branch protection's required-status-checks list (added during PR #150 close-out). `CI / e2e (pull_request)` left as not-required pending one more clean PR run as the threshold.
|
||||
- Recorded the broader silent-return concern in TODO backlog: the `currentChatRef.current !== sentForChatId` guard is applied across `handleSend`, `handleTaskSubmit`, `selectChat`, `refreshFacts`, `refreshActiveFix`, and `refreshPreview`. PR #153 fixes one symptom but the same pattern can mask other drift. Either log a Sentry breadcrumb on the mismatch path or distinguish "expected stale" (chat switch) from "unexpected stale" (ref never updated) so the latter alerts.
|
||||
- Left for next session: watch PR #153 CI on `1559feb`, merge when green, then decide whether to promote `CI / e2e (pull_request)` to required and pick the next item from `TODO.md` — natural pairing is the `currentChatRef` silent-return audit added to backlog this session.
|
||||
- Files touched: `frontend/src/pages/AssistantChatPage.tsx` (the one-line fix + comment), `frontend/e2e/assistant-chat-prefill.spec.ts` (new regression test), `.ai/TODO.md` (silent-return follow-up entry, plus conflict resolution preserving PR #150's backlog additions), `.ai/CURRENT_TASK.md` (rolled forward to PR #153 active task; previous task closed out), `.ai/HANDOFF.md` (new resume point), `.ai/SESSION_LOG.md` (this entry).
|
||||
|
||||
## 2026-04-25 16:41 EDT — Codex — Stabilize PR #150 e2e selectors
|
||||
|
||||
- Investigated the remaining PR #150 failure after backend and frontend CI were green. The e2e resume smoke test was not failing because of product behavior; it used `.bg-card` plus text filtering and matched the tree filter `<select>` before the intended session card.
|
||||
|
||||
Reference in New Issue
Block a user