From 861d082ff784012c0debd60971a3b4fc3c8a7ab8 Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Thu, 23 Apr 2026 23:41:17 -0400 Subject: [PATCH] =?UTF-8?q?docs(pilot):=20Phase=209=20spec=20=E2=80=94=20c?= =?UTF-8?q?onsistency=20pass=20on=20Apply=20stamp=20call=20sites?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three consistency fixes: - File inventory (backend + frontend) now names all three apply-stamp call sites: handleScriptDecision('one_off' | 'draft_template') plus TemplateMatchPanel's 'I ran this' handler. Previously listed only 'one_off' in two places, contradicting the §5 lifecycle table. - NoTemplateDialog relocation section no longer claims the decision handler is 'unchanged' — it is unchanged EXCEPT for the moved apply stamp, which is the point of §5. - Open deferrals entry on ScriptBuilderChat 'ephemeral mode' removed; replaced with the actual new surface (ScriptBuilderTab controller), which reuses the existing script-builder prompt unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/FlowAssist_Migration/phase-9-script-builder-tab.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/FlowAssist_Migration/phase-9-script-builder-tab.md b/docs/FlowAssist_Migration/phase-9-script-builder-tab.md index afdabe75..babba435 100644 --- a/docs/FlowAssist_Migration/phase-9-script-builder-tab.md +++ b/docs/FlowAssist_Migration/phase-9-script-builder-tab.md @@ -90,7 +90,7 @@ A header toolbar above the controller's render area hosts the mode toggle: - Removed from `TaskLane.bottomSlot`. Renders in the chat region, slide-up-above-composer (same mechanical placement as `ProposalBanner`). - The three-card layout (`grid-cols-3` at the chat region's natural width) actually fits — no `grid-cols-1` regression needed. - Opens when the engineer clicks Apply on the banner AND `fix.ai_drafted_script` is non-empty. -- Existing `handleScriptDecision` logic unchanged; only the render location moves. +- Decision semantics unchanged (still `one_off` / `draft_template` / `build_template` with the same server-side effects) except for the moved apply stamp — see §5. Only the render location changes beyond that. ### 4. Banner Apply routing (updated) @@ -345,7 +345,7 @@ Manual verification (no component test harness in this codebase per CLAUDE.md): - `backend/app/models/script_builder_session.py` — add `origin` column only (`ai_session_id` already exists). - `backend/app/schemas/session_suggested_fix.py` — add `SessionSuggestedFixScriptRequest`. - `backend/app/schemas/script_builder.py` (or equivalent) — add optional `origin` field to the `POST /script-builder/sessions` request schema; default `'standalone'`. -- `backend/app/api/endpoints/session_suggested_fixes.py` — add PATCH /script endpoint. Move the existing `applied_at` stamp out of the apply path and into `handleScriptDecision('one_off')` only (server side: no change to `/apply`; callers shift instead). +- `backend/app/api/endpoints/session_suggested_fixes.py` — add PATCH /script endpoint. Move the existing `applied_at` stamp out of the apply path and into `handleScriptDecision('one_off' | 'draft_template')` plus `TemplateMatchPanel`'s new "I ran this" handler (server side: no change to `/apply`; callers shift instead). - `backend/app/api/endpoints/script_builder.py` — accept `origin` on session creation; enforce the `pilot_inline ⇒ ai_session_id` invariant at the handler level. - `backend/app/services/script_builder_service.py` — persist `origin`; `list_sessions` + `count_user_sessions` filter to `origin='standalone'` by default. - `backend/app/models/session_suggested_fix.py` — unchanged (schema already has `ai_drafted_script`). @@ -360,7 +360,7 @@ Manual verification (no component test harness in this codebase per CLAUDE.md): - `frontend/src/api/scriptBuilder.ts` (or equivalent) — `createSession` accepts an optional `origin` argument. - `frontend/src/components/script-builder/ScriptBuilderChat.tsx` — **unchanged**. Stays a pure display component. - `frontend/src/pages/ScriptBuilderPage.tsx` — **unchanged on the session-creation path** (defaults to `origin='standalone'`). -- `frontend/src/pages/AssistantChatPage.tsx` — wire tab strip, mount `ScriptBuilderTab`, banner Apply routing (no `applied_at` stamp on click), NoTemplateDialog chat-region render. Move the `sessionSuggestedFixesApi.applyFix(...)` call from `handleApplyFix` to `handleScriptDecision('one_off')` and the TemplateMatchPanel run-path handler. +- `frontend/src/pages/AssistantChatPage.tsx` — wire tab strip, mount `ScriptBuilderTab`, banner Apply routing (no `applied_at` stamp on click), NoTemplateDialog chat-region render. Move the `sessionSuggestedFixesApi.applyFix(...)` call from `handleApplyFix` to `handleScriptDecision('one_off' | 'draft_template')` and `TemplateMatchPanel`'s new "I ran this" handler. - `frontend/src/components/pilot/EscalateInterceptDialog.tsx` — add fourth choice. - `frontend/src/components/pilot/TaskLane.tsx` — remove `bottomSlot` usage of NoTemplateDialog (leave prop API stable). @@ -379,5 +379,5 @@ Manual verification (no component test harness in this codebase per CLAUDE.md): ## Open deferrals (acknowledged, not in this phase) - `window.prompt` → inline input migration for partial notes / failure reasons. -- Anti-parrot compliance of any new AI system prompt used by `ScriptBuilderChat` for ephemeral mode — verify it's the same safe prompt the standalone mode already uses (no new content to guard). +- Anti-parrot compliance check for the inline `ScriptBuilderTab` flow — verify it reuses the existing script-builder AI system prompt (no new prompt content introduced; the controller only changes what `onSaveScript` does, not what the AI sees). - Telemetry events for tab opens / AI→editor toggles / script submissions from tab — add in the Phase 9 implementation plan if we want them.