Skip to content

Fix roadmap generation phase mapping and progress heartbeat#1924

Open
VDT-91 wants to merge 4 commits intoAndyMik90:auto-claude/237-migrate-claude-agent-sdk-python-to-vercel-ai-sdk-tfrom
VDT-91:feat/roadmap
Open

Fix roadmap generation phase mapping and progress heartbeat#1924
VDT-91 wants to merge 4 commits intoAndyMik90:auto-claude/237-migrate-claude-agent-sdk-python-to-vercel-ai-sdk-tfrom
VDT-91:feat/roadmap

Conversation

@VDT-91
Copy link
Collaborator

@VDT-91 VDT-91 commented Mar 6, 2026

Summary

Fix roadmap generation progress/state mismatch and improve visibility during long-running phases.

Root cause

Backend roadmap runner emitted legacy phase names (discovery, features) while renderer state machine expects canonical names (discovering, generating).

Fixes in this PR

  • Normalize legacy roadmap phases in queue, renderer store, and persisted-progress load path.
  • Add throttled progress heartbeats during streaming (text-delta/tool-use) so long steps do not appear frozen.

Result

Roadmap progress now transitions correctly:
analyzing -> discovering -> generating -> complete

@VDT-91
Copy link
Collaborator Author

VDT-91 commented Mar 6, 2026

Plain-language bug summary: roadmap progress events used old phase names (discovery, eatures) while the frontend state machine only accepts (discovering, generating). That mismatch caused state errors / stuck progress behavior. This PR normalizes those phases at queue/store/load boundaries and adds heartbeat progress updates so long AI steps remain visibly active.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical issues in the roadmap generation process by ensuring consistent phase mapping and providing more frequent progress updates. The changes prevent the UI from displaying incorrect or stalled progress, leading to a more accurate and responsive user experience during roadmap creation.

Highlights

  • Roadmap Phase Normalization: Implemented logic across the agent queue, IPC handlers, and renderer store to normalize legacy roadmap phase names (e.g., 'discovery', 'features') to their canonical counterparts (e.g., 'discovering', 'generating'). This resolves a state mismatch between the backend runner and the frontend UI.
  • Progress Heartbeat Mechanism: Introduced a throttled progress heartbeat mechanism during streaming phases ('text-delta', 'tool-use') of roadmap generation. This ensures that the UI receives regular updates, preventing long-running steps from appearing frozen and improving user visibility.
Changelog
  • apps/desktop/src/main/agent/agent-queue.ts
    • Imported RoadmapGenerationStatus type.
    • Added new types and constants for roadmap phases and heartbeat intervals.
    • Implemented getRoadmapHeartbeatMessage to provide descriptive messages for each phase.
    • Introduced normalizeRoadmapPhase to convert legacy phase names to canonical ones.
    • Updated persistRoadmapProgress to use the new RoadmapPhase type.
    • Initialized progressPhase with the RoadmapPhase type and added lastHeartbeatAt for throttling.
    • Created emitRoadmapHeartbeat function to send throttled progress updates.
    • Applied normalizeRoadmapPhase when a new phase starts.
    • Integrated emitRoadmapHeartbeat into text-delta and tool-use stream events to provide continuous progress.
  • apps/desktop/src/main/ipc-handlers/roadmap-handlers.ts
    • Added normalizeRoadmapProgressPhase function to handle legacy phase aliases for persisted progress.
    • Modified the loadRoadmapProgress handler to use the normalization function when reading saved progress, ensuring consistency with frontend expectations.
  • apps/desktop/src/renderer/stores/roadmap-store.ts
    • Implemented normalizeGenerationPhase to convert legacy phase names received from the backend into the canonical phases expected by the XState machine.
    • Applied normalizeGenerationPhase to the incoming status.phase within setGenerationStatus to ensure the frontend state machine always operates with correct phase names.
    • Updated the getOrCreateGenerationActor and subsequent event dispatches to use the normalized status.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves the roadmap generation phase mismatch by introducing normalization logic at multiple layers of the application. The changes in agent-queue.ts, roadmap-handlers.ts, and roadmap-store.ts ensure that legacy phase names are correctly mapped to their canonical versions, fixing the core issue. Additionally, the introduction of throttled progress heartbeats in agent-queue.ts is a great UX improvement that provides better visibility during long-running generation steps. My main feedback is about code duplication of the phase normalization logic, which is present in three different files. Centralizing this logic would improve maintainability.

Comment on lines +197 to +217
/**
* Normalize inbound phase aliases from backend/legacy progress files
* to the canonical roadmap generation phases expected by XState.
*/
function normalizeGenerationPhase(phase: string): RoadmapGenerationStatus['phase'] {
switch (phase) {
case 'idle':
case 'analyzing':
case 'discovering':
case 'generating':
case 'complete':
case 'error':
return phase;
case 'discovery':
return 'discovering';
case 'features':
return 'generating';
default:
return 'analyzing';
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This normalization logic is duplicated across three files:

  • apps/desktop/src/main/agent/agent-queue.ts (normalizeRoadmapPhase)
  • apps/desktop/src/main/ipc-handlers/roadmap-handlers.ts (normalizeRoadmapProgressPhase)
  • Here in roadmap-store.ts (normalizeGenerationPhase)

To improve maintainability, this logic should be centralized.

Furthermore, this normalization in the renderer might be redundant. The backend appears to normalize phases in agent-queue.ts (from the runner) and roadmap-handlers.ts (from persisted files) before sending data to the renderer. If the backend guarantees normalized phases over IPC, this function and its usage in setGenerationStatus could be removed, simplifying the renderer code.

If this defensive normalization is still desired, consider moving the function to a shared utility file (e.g., in apps/desktop/src/shared/utils/) to be used by both renderer and main process code, which would resolve the duplication.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • develop
  • release/*
  • hotfix/*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ad4708f2-b4cf-47c2-800e-8f66753e79e5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant