-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(roadmap): harden generation startup and artifact parsing #1958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
VDT-91
wants to merge
3
commits into
AndyMik90:develop
Choose a base branch
from
VDT-91:fix/roadmap-generation-reliability
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { EventEmitter } from 'node:events'; | ||
| import { mkdtempSync, rmSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join } from 'node:path'; | ||
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; | ||
|
|
||
| const { | ||
| runRoadmapGenerationMock, | ||
| writeFileWithRetryMock, | ||
| } = vi.hoisted(() => ({ | ||
| runRoadmapGenerationMock: vi.fn(), | ||
| writeFileWithRetryMock: vi.fn().mockResolvedValue(undefined), | ||
| })); | ||
|
|
||
| vi.mock('../ai/runners/roadmap', () => ({ | ||
| runRoadmapGeneration: runRoadmapGenerationMock, | ||
| })); | ||
|
|
||
| vi.mock('../utils/atomic-file', () => ({ | ||
| writeFileWithRetry: writeFileWithRetryMock, | ||
| })); | ||
|
|
||
| vi.mock('../utils/debounce', () => ({ | ||
| debounce: (fn: (...args: unknown[]) => unknown) => ({ | ||
| fn, | ||
| cancel: vi.fn(), | ||
| }), | ||
| })); | ||
|
|
||
| import { AgentQueueManager } from '../agent/agent-queue'; | ||
| import { AgentState } from '../agent/agent-state'; | ||
|
|
||
| describe('AgentQueueManager roadmap progress mapping', () => { | ||
| let projectPath: string; | ||
|
|
||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| projectPath = mkdtempSync(join(tmpdir(), 'agent-queue-')); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| rmSync(projectPath, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| it('maps runner phase names to frontend roadmap phases', async () => { | ||
| runRoadmapGenerationMock.mockImplementation( | ||
| async ( | ||
| _config: unknown, | ||
| onStream?: (event: { type: string; phase?: string }) => void, | ||
| ) => { | ||
| onStream?.({ type: 'phase-start', phase: 'discovery' }); | ||
| onStream?.({ type: 'phase-start', phase: 'features' }); | ||
|
|
||
| return { | ||
| success: false, | ||
| phases: [], | ||
| error: 'boom', | ||
| }; | ||
| }, | ||
| ); | ||
|
|
||
| const emitter = new EventEmitter(); | ||
| const progressUpdates: Array<{ phase: string; progress: number; message: string }> = []; | ||
| emitter.on('roadmap-progress', (_projectId, status) => { | ||
| progressUpdates.push(status); | ||
| }); | ||
|
|
||
| const queue = new AgentQueueManager( | ||
| new AgentState(), | ||
| {} as never, | ||
| { killProcess: vi.fn() } as never, | ||
| emitter, | ||
| ); | ||
|
|
||
| await queue.startRoadmapGeneration('project-1', projectPath); | ||
|
|
||
| expect(progressUpdates.map((status) => status.phase)).toEqual([ | ||
| 'analyzing', | ||
| 'discovering', | ||
| 'generating', | ||
| ]); | ||
| expect(progressUpdates[1]?.message).toContain('discovery'); | ||
| expect(progressUpdates[2]?.message).toContain('features'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 24470
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 1792
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 1375
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 2430
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 3200
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 579
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 829
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 1439
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 4084
🏁 Script executed:
# Check agent-manager imports and class definition to find getResolvedAuth signature head -50 apps/desktop/src/main/agent/agent-manager.tsRepository: AndyMik90/Aperant
Length of output: 2404
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 2200
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 2667
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 598
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 1537
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 2412
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 3349
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 8017
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 43
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 2791
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 549
🏁 Script executed:
Repository: AndyMik90/Aperant
Length of output: 1134
Thread
abortSignalthroughresolveAuthFromProviderQueue()to enable cancellation on both queue and fallback auth paths.resolveAuthFromProviderQueue()in agent-manager.ts (line 135) lacks anabortSignalparameter, so cancellation never reaches the fallbackresolveAuth()call at line 193. Meanwhile, factory.ts properly threadsabortSignalthroughresolveAuth()calls. SincestartSpecCreation,startTaskExecution, andstartQAProcesscan be cancelled (viastopIdeation/stopRoadmap), auth resolution should respect cancellation.Add
abortSignal?: AbortSignaltoresolveAuthFromProviderQueue()signature and pass it to bothresolveAuthFromQueue()(line 176) andresolveAuth()(line 193) to match the pattern already established in factory.ts.🤖 Prompt for AI Agents