Skip to content

feat(studio): auto-advance from content phase to style phase#52

Merged
mrcfps merged 2 commits into
nexu-io:mainfrom
walliai666:feat/studio-content-phase-autoadvance
Jun 21, 2026
Merged

feat(studio): auto-advance from content phase to style phase#52
mrcfps merged 2 commits into
nexu-io:mainfrom
walliai666:feat/studio-content-phase-autoadvance

Conversation

@walliai666

Copy link
Copy Markdown
Contributor

After the content-collection turn, if the agent reply does not contain (the structured marker the content prompt requires when still collecting), immediately spawn a second agent in the same SSE stream to present the style options card — eliminating the extra user round-trip between content and style phases.

Resolves #43

After the content-collection turn, if the agent reply does not contain
<!-- hv-phase:content-question --> (the structured marker the content
prompt requires when still collecting), immediately spawn a second agent
in the same SSE stream to present the style options card — eliminating
the extra user round-trip between content and style phases.

@lefarcen lefarcen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @walliai-chenlb! Impressive turnaround — you filed the bug, identified the root cause at the right file:line, and opened a PR within the 1–3 day window. The server-side auto-advance approach is exactly the right direction.

One thing needs fixing before this can land: the auto-advance check will never fire for a well-behaved agent in the current state. Details inline. There's also a smaller DRY issue worth cleaning up at the same time.

DRY note (line 1170): the stylePrompt block duplicates the style phase builder verbatim from buildHtmlGenerationPrompt's phase === 'style' branch (~line 2579) — same question text, same five options, same trailing instructions. If someone adds a sixth style option or changes a hint there, this copy will silently drift. Once the P1 fix is in, it's worth extracting buildHtmlGenerationPrompt's style section into a small shared helper (e.g. buildStylePhasePrompt(pickedType)) that both places call.

Comment thread packages/cli/src/studio-server.ts
…ompt helper

The content prompt told the agent to always append <!-- hv-phase:content-question -->
even when it had enough info and was writing a "Got it, next: style" confirmation.
Because the marker was always present, the server-side !regex.test() check never
triggered and auto-advance was a no-op.

Fix: rewrite the "already have enough" branch to explicitly instruct the agent NOT
to append the marker when it's done — the server advances automatically on its absence.

Also extract the duplicated style-phase prompt block (present verbatim in both the
auto-advance path and buildHtmlGenerationPrompt's style branch) into a shared
buildStylePhasePrompt(pickedType) helper so future edits only need to happen once.
@walliai666 walliai666 requested a review from lefarcen June 15, 2026 10:17

@lefarcen lefarcen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both issues fixed — nice work on the turnaround.

P1 looks exactly right. The old prompt said "end with the marker" in both branches, so the server's !regex.test() never fired. The new wording explicitly splits the two paths — marker when you still need info, no marker (and a note saying so) when you're done — which is exactly what the server logic needs. The trailing-instruction cleanup (Reply in plain text. → dropped the old + the marker suffix) closes the last escape hatch.

DRY: buildStylePhasePrompt(pickedType) is clean. The array-push style matches the surrounding code, both call sites are updated, and the style branch in buildHtmlGenerationPrompt now delegates to it correctly.

No further concerns from my side. @PerishCode — picking up the code review baton from here. ✨

@mrcfps mrcfps merged commit c414ecc into nexu-io:main Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/medium Medium risk size/S Size S (20-99 LOC) type/feature Feature change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio agent announces "next: style" but style card doesn't appear until user sends another message

3 participants