Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions apps/server/src/services/auto-mode-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ export class AutoModeService {
// Track which projects have already been checked for interrupted features this server lifecycle.
// Prevents the UI from re-triggering resumeInterruptedFeatures on every board mount.
private resumeCheckedProjects = new Set<string>();
/**
* Pending CI failure messages to inject into running agent sessions.
* Keyed by featureId. Consumed by executeFeature continuation after the
* current agent turn completes (when isAgentRunning was true at receipt).
*/
private pendingCIInjections = new Map<string, string>();
// Memory management thresholds (configurable via env vars)
private readonly HEAP_USAGE_STOP_NEW_AGENTS_THRESHOLD = parseFloat(
process.env.HEAP_STOP_THRESHOLD || '0.8'
Expand Down Expand Up @@ -1070,7 +1064,6 @@ export class AutoModeService {
if (running.projectPath === projectPath) {
running.abortController.abort();
this.runningFeatures.delete(featureId);
this.pendingCIInjections.delete(featureId);
logger.info(`Aborted running feature ${featureId} during auto-loop stop`);
}
}
Expand Down Expand Up @@ -1524,7 +1517,6 @@ export class AutoModeService {
// The abort signal will still propagate to stop any ongoing execution
this.concurrencyManager.release(featureId);
this.runningFeatures.delete(featureId);
this.pendingCIInjections.delete(featureId);
this.typedEventBus.clearFeature(featureId);
activeAgentsCount.set(this.runningFeatures.size);

Expand Down Expand Up @@ -1587,7 +1579,6 @@ export class AutoModeService {
logger.info(`[Shutdown] Aborted feature: ${featureId}`);
}
this.runningFeatures.clear();
this.pendingCIInjections.clear();

// Unsubscribe all event listeners to prevent leaks on restart
for (const sub of this.eventSubscriptions) {
Expand All @@ -1612,42 +1603,6 @@ export class AutoModeService {
return running !== undefined && running.projectPath === projectPath;
}

/**
* Inject a CI failure message into the running agent session for a feature.
* Stores the message as a pending CI injection; the message will be used as a
* continuation prompt after the current agent turn completes, so the agent
* can fix the CI failure without a full restart.
*
* Matches on both featureId and projectPath to prevent cross-project injection.
* Returns true if a running session was found and the injection was queued.
*/
async sendCIFailureToAgent(
featureId: string,
projectPath: string,
message: string
): Promise<boolean> {
const running = this.runningFeatures.get(featureId);
if (!running || running.projectPath !== projectPath) {
return false;
}
this.pendingCIInjections.set(featureId, message);
logger.info(`CI failure queued for injection into running agent for feature ${featureId}`);
return true;
}

/**
* Consume and return a pending CI injection message for a feature (if any).
* Called by executeFeature after the current run completes to chain the CI fix.
* @internal
*/
consumePendingCIInjection(featureId: string): string | undefined {
const message = this.pendingCIInjections.get(featureId);
if (message !== undefined) {
this.pendingCIInjections.delete(featureId);
}
return message;
}

/**
* Mark a single running feature as interrupted.
* Called during shutdown to persist the interrupted state before aborting agents.
Expand Down
Loading
Loading