docs: diagnose AI Design streaming and generation
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
# Task: Diagnose AI Design streaming and generation trigger
|
||||
|
||||
## Identity
|
||||
|
||||
- Task ID: 20260904-diagnose-design-stream-6a4e9c21
|
||||
- Mode: Feature
|
||||
- Branch: codex/20260904-diagnose-design-stream-6a4e9c21-diagnose-design-stream
|
||||
- Worktree: D:\Datas\OthersProjects\.codex-worktrees\makelore\20260904-diagnose-design-stream-6a4e9c21
|
||||
- Base commit: aa3f52a8f8414c9ad939d396bd2828c3e07c70e7
|
||||
- Owner: codex-root
|
||||
- Status: Ready for Integration
|
||||
|
||||
## Scope
|
||||
|
||||
- Diagnose, without changing product behavior, why AI Design assistant replies no
|
||||
longer appear incrementally and why the screenshot path does not visibly create a
|
||||
generation Task.
|
||||
- Trace the current Renderer/store/Main contracts at the public test seams for
|
||||
`design.assistant.delta`, Quote request/opening, immutable Quote confirmation, and
|
||||
Workspace Task reconciliation.
|
||||
- Build focused red-capable regressions that distinguish a presentation regression
|
||||
from a transport failure and distinguish “no Quote requested” from “Quote confirmed
|
||||
but no Task recovered”. Remove temporary probes before completion.
|
||||
- Own only this task record and temporary diagnostic tests. Do not change product
|
||||
code, the Works Square server, database, billing, packaging, publication, Plugin
|
||||
navigation, or the three foreign untracked root task records.
|
||||
|
||||
## Intent And Constraints
|
||||
|
||||
- The user reports two observable regressions after the conversation-feedback UI
|
||||
changes: completed assistant text arrives all at once, and the ready-state action
|
||||
appears not to trigger generation.
|
||||
- Preserve ADR-007. Streaming deltas are not canonical conversation turns, but the
|
||||
diagnosis must determine whether they can be presented as an explicitly unfinished
|
||||
reply without duplicating the right-side Current Specification summary.
|
||||
- Generation remains a deliberate two-step boundary: request/check an immutable Quote,
|
||||
then explicitly confirm its ID. A chat reply saying creation is possible is not
|
||||
authorization to create a paid Task.
|
||||
- Do not infer failure from the screenshot alone. Reproduce the actual button callback,
|
||||
panel-mount, command dispatch, confirmation, and Task projection seams one at a time.
|
||||
- Preserve stable operation identity and no-replay behavior while diagnosing.
|
||||
|
||||
## Project Context Loaded
|
||||
|
||||
- Concurrent Task Gate and Planning Gate passed in the managed isolated worktree at
|
||||
exact client `main` base `aa3f52a8f8414c9ad939d396bd2828c3e07c70e7`.
|
||||
- Loaded the startup memory set, ADR-007, architecture/data flow, business rules,
|
||||
success criteria, evidence/reflection/commitment indexes, and the three integrated
|
||||
AI Design conversation-feedback task records.
|
||||
- Assessed 176 peer task records with no unreadable record. Relevant Canvas peers are
|
||||
historical Ready-for-Integration sources already reflected in this base; none is a
|
||||
live semantic conflict. One old undefined Design assessment remains unknown but is
|
||||
on a stale base and this task is read-only diagnosis.
|
||||
- Likely seams are `DesignConversationPane`, `YouthCreationCard`, the ImageCanvas
|
||||
composition, `image-workspace` store, Quote/Task panels, and focused unit/Electron
|
||||
fixtures.
|
||||
- Gate result: Passed.
|
||||
|
||||
## Outcome
|
||||
|
||||
- Confirmed a Renderer presentation regression rather than a transport outage. The
|
||||
server still persists and emits `design.assistant.delta`; Main maps it and the
|
||||
Renderer store deduplicates and appends it to `assistantStreams`. The current
|
||||
`DesignConversationPane` no longer subscribes to or renders that state, so only the
|
||||
later canonical `workspace.turns` assistant message becomes visible.
|
||||
- Identified the exact history. Commit `c6b0490` replaced the visible unfinished text
|
||||
with a generic progress banner to keep the reasoner's summary-like draft out of the
|
||||
conversation. Commit `3bda17a` then removed both the banner and the
|
||||
`assistantStreams` subscription. The latter change explains why replies now appear
|
||||
only after completion.
|
||||
- Confirmed the server event is not provider-native time-to-first-token streaming.
|
||||
`OpenAIJsonDesignReasoningRunner` waits for one complete JSON-object response;
|
||||
`DesignAgentRuntimeV2` then takes the validated canonical `assistant_message`, splits
|
||||
it into six-character chunks, and the Gateway spaces frames by 60 ms. Restoring the
|
||||
old bubble would restore incremental painting only after reasoning has completed and
|
||||
risks recreating the summary-as-chat confusion reported by the user.
|
||||
- Built a temporary red-capable Renderer probe that seeded a pending operation plus
|
||||
`assistantStreams` text. It failed because no streamed text was rendered, while the
|
||||
provisional user message remained visible. The probe was removed after diagnosis.
|
||||
- Found no break in the current source generation command chain. A ready Creation Card
|
||||
calls `requestQuote`; an offered immutable Quote exposes an explicit Design Point
|
||||
confirmation; confirmation calls `confirmGeneration(quoteId)`; the Electron flow
|
||||
projects the resulting Task. Focused unit tests and the real Electron scenario pass.
|
||||
- The supplied screenshot is factually before Quote confirmation: the card is still in
|
||||
`ready` and offers “看看制作方案”. A chat sentence saying the design can be generated
|
||||
is not authorization for a paid Task. Whether that particular installed client
|
||||
emitted a Quote command after a click remains unverified because no matching Run or
|
||||
client version was supplied.
|
||||
- No product, server, database, billing, packaging, publication, or Plugin navigation
|
||||
code was changed.
|
||||
|
||||
## Verification
|
||||
|
||||
- Temporary red probe:
|
||||
`pnpm exec vitest run tests/unit/image-canvas-page.test.tsx -t "shows unfinished assistant reply text incrementally"`
|
||||
-> expected failure: streamed text was absent from the conversation. The temporary
|
||||
assertion was restored and is not part of this task.
|
||||
- `pnpm exec vitest run tests/unit/youth-creation-card.test.tsx tests/unit/image-canvas-page.test.tsx -t "plain creation summary|production confirmation"`
|
||||
-> 2 passed, 15 skipped.
|
||||
- `pnpm run build:vite` -> passed for Renderer, Main, Preload, and utility processes;
|
||||
only existing Browserslist, chunk-size, and dynamic-import warnings were reported.
|
||||
- `node ./node_modules/@playwright/test/cli.js test tests/e2e/image-workspace-v2.spec.ts -g "keeps conversation and youth-friendly direct edits"`
|
||||
-> 1 passed. The scenario exercised “看看制作方案” -> offered Quote -> explicit
|
||||
Design Point confirmation -> queued Task projection.
|
||||
|
||||
## Follow-ups
|
||||
|
||||
- Product decision required before implementation: choose between (a) showing the
|
||||
already-finalized assistant message with a typewriter effect after reasoning, or
|
||||
(b) introducing a distinct conversational streaming contract that can emit safe
|
||||
assistant prose before the structured Specification proposal is complete. Option
|
||||
(b) is the only route to genuine lower time-to-first-visible-text; do not render raw
|
||||
structured reasoner JSON or revive the former summary-like draft bubble.
|
||||
- Make the two-step production boundary explicit in the conversation: when the assistant
|
||||
says the idea is ready, point to or provide an inline “看看制作方案” action; after Quote
|
||||
creation, keep the existing explicit Design Point confirmation. Do not auto-create a
|
||||
paid Task from ordinary chat.
|
||||
- If a user reports that clicking “看看制作方案” itself does nothing, capture that exact
|
||||
operation's client version, `client_operation_id`, and `design.quote.request` Run. The
|
||||
current source/Electron fixture does not reproduce such a failure.
|
||||
|
||||
## Promotion Candidates
|
||||
|
||||
- Target canonical documents: `.project-docs/20-architecture/system-overview.md` and
|
||||
`.project-docs/40-domain/business-rules.md`. Proposal: distinguish provider-native
|
||||
conversational streaming from post-validation chunk projection, and record that
|
||||
readiness chat must lead users to Quote review but cannot itself authorize a paid
|
||||
generation Task. Evidence: this task's red presentation probe, commit history, and
|
||||
passing end-to-end Quote-confirm-Task flow. Future impact: prevents another UI change
|
||||
from conflating an internal structured-reasoning draft, a canonical assistant turn,
|
||||
and a progress indicator. No known semantic conflict; human confirmation is required
|
||||
because the streaming architecture and conversation CTA behavior are product choices.
|
||||
Reference in New Issue
Block a user