Fix: Dev server detection bug fixes. Settings sync bug fixes. Cli provider fixes. Terminal background/foreground colors (#791)

* Changes from fix/dev-server-state-bug

* feat: Add configurable max turns setting with user overrides. Address pr comments

* fix: Update default behaviors and improve state management across server and UI

* feat: Extract branch sync logic to separate service. Fix settings sync bug. Address pr comments

* refactor: Extract magic numbers to named constants and improve branch tracking logic

- Add DEFAULT_MAX_TURNS (1000) and MAX_ALLOWED_TURNS (2000) constants to settings-helpers
- Replace hardcoded 1000 values with DEFAULT_MAX_TURNS constant throughout codebase
- Improve max turns validation with explicit Number.isFinite check
- Update getTrackingBranch to split on first slash instead of last for better remote parsing
- Change isBranchCheckedOut return type from boolean to string|null to return worktree path
- Add comments explaining skipFetch parameter in worktree creation
- Fix cleanup order in AgentExecutor finally block to run before logging
```

* feat: Add comment refresh and improve model sync in PR dialog
This commit is contained in:
gsxdsm
2026-02-21 08:57:04 -08:00
committed by GitHub
parent c81ea768a7
commit 3ddf26f666
41 changed files with 2705 additions and 274 deletions

View File

@@ -170,14 +170,16 @@ describe('PipelineOrchestrator', () => {
} as unknown as WorktreeResolver;
mockConcurrencyManager = {
acquire: vi.fn().mockReturnValue({
featureId: 'feature-1',
acquire: vi.fn().mockImplementation(({ featureId, isAutoMode }) => ({
featureId,
projectPath: '/test/project',
abortController: new AbortController(),
branchName: null,
worktreePath: null,
}),
isAutoMode: isAutoMode ?? false,
})),
release: vi.fn(),
getRunningFeature: vi.fn().mockReturnValue(undefined),
} as unknown as ConcurrencyManager;
mockSettingsService = null;
@@ -541,8 +543,18 @@ describe('PipelineOrchestrator', () => {
);
});
it('should emit auto_mode_feature_complete on success', async () => {
it('should emit auto_mode_feature_complete on success when isAutoMode is true', async () => {
vi.mocked(performMerge).mockResolvedValue({ success: true });
vi.mocked(mockConcurrencyManager.getRunningFeature).mockReturnValue({
featureId: 'feature-1',
projectPath: '/test/project',
abortController: new AbortController(),
branchName: null,
worktreePath: null,
isAutoMode: true,
startTime: Date.now(),
leaseCount: 1,
});
const context = createMergeContext();
await orchestrator.attemptMerge(context);
@@ -553,6 +565,19 @@ describe('PipelineOrchestrator', () => {
);
});
it('should not emit auto_mode_feature_complete on success when isAutoMode is false', async () => {
vi.mocked(performMerge).mockResolvedValue({ success: true });
vi.mocked(mockConcurrencyManager.getRunningFeature).mockReturnValue(undefined);
const context = createMergeContext();
await orchestrator.attemptMerge(context);
const completeCalls = vi
.mocked(mockEventBus.emitAutoModeEvent)
.mock.calls.filter((call) => call[0] === 'auto_mode_feature_complete');
expect(completeCalls.length).toBe(0);
});
it('should return needsAgentResolution true on conflict', async () => {
vi.mocked(performMerge).mockResolvedValue({
success: false,
@@ -623,13 +648,24 @@ describe('PipelineOrchestrator', () => {
expect(mockExecuteFeatureFn).toHaveBeenCalled();
});
it('should complete feature when step no longer exists', async () => {
it('should complete feature when step no longer exists and emit event when isAutoMode=true', async () => {
const invalidPipelineInfo: PipelineStatusInfo = {
...validPipelineInfo,
stepIndex: -1,
step: null,
};
vi.mocked(mockConcurrencyManager.getRunningFeature).mockReturnValue({
featureId: 'feature-1',
projectPath: '/test/project',
abortController: new AbortController(),
branchName: null,
worktreePath: null,
isAutoMode: true,
startTime: Date.now(),
leaseCount: 1,
});
await orchestrator.resumePipeline('/test/project', testFeature, true, invalidPipelineInfo);
expect(mockUpdateFeatureStatusFn).toHaveBeenCalledWith(
@@ -642,6 +678,28 @@ describe('PipelineOrchestrator', () => {
expect.objectContaining({ message: expect.stringContaining('no longer exists') })
);
});
it('should not emit feature_complete when step no longer exists and isAutoMode=false', async () => {
const invalidPipelineInfo: PipelineStatusInfo = {
...validPipelineInfo,
stepIndex: -1,
step: null,
};
vi.mocked(mockConcurrencyManager.getRunningFeature).mockReturnValue(undefined);
await orchestrator.resumePipeline('/test/project', testFeature, true, invalidPipelineInfo);
expect(mockUpdateFeatureStatusFn).toHaveBeenCalledWith(
'/test/project',
'feature-1',
'verified'
);
const completeCalls = vi
.mocked(mockEventBus.emitAutoModeEvent)
.mock.calls.filter((call) => call[0] === 'auto_mode_feature_complete');
expect(completeCalls.length).toBe(0);
});
});
describe('resumeFromStep', () => {
@@ -666,7 +724,7 @@ describe('PipelineOrchestrator', () => {
expect(mockRunAgentFn).toHaveBeenCalled();
});
it('should complete feature when all remaining steps excluded', async () => {
it('should complete feature when all remaining steps excluded and emit event when isAutoMode=true', async () => {
const featureWithAllExcluded: Feature = {
...testFeature,
excludedPipelineSteps: ['step-1', 'step-2'],
@@ -674,6 +732,16 @@ describe('PipelineOrchestrator', () => {
vi.mocked(pipelineService.getNextStatus).mockReturnValue('verified');
vi.mocked(pipelineService.isPipelineStatus).mockReturnValue(false);
vi.mocked(mockConcurrencyManager.getRunningFeature).mockReturnValue({
featureId: 'feature-1',
projectPath: '/test/project',
abortController: new AbortController(),
branchName: null,
worktreePath: null,
isAutoMode: true,
startTime: Date.now(),
leaseCount: 1,
});
await orchestrator.resumeFromStep(
'/test/project',
@@ -1033,7 +1101,7 @@ describe('PipelineOrchestrator', () => {
);
});
it('handles all steps excluded during resume', async () => {
it('handles all steps excluded during resume and emits event when isAutoMode=true', async () => {
const featureWithAllExcluded: Feature = {
...testFeature,
excludedPipelineSteps: ['step-1', 'step-2'],
@@ -1041,6 +1109,16 @@ describe('PipelineOrchestrator', () => {
vi.mocked(pipelineService.getNextStatus).mockReturnValue('verified');
vi.mocked(pipelineService.isPipelineStatus).mockReturnValue(false);
vi.mocked(mockConcurrencyManager.getRunningFeature).mockReturnValue({
featureId: 'feature-1',
projectPath: '/test/project',
abortController: new AbortController(),
branchName: null,
worktreePath: null,
isAutoMode: true,
startTime: Date.now(),
leaseCount: 1,
});
await orchestrator.resumeFromStep(
'/test/project',