Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: surface the runner promotion on the CoS log stream (#4134)

Adam Eivy99ebdee81ee7
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.js
index 4617148221..8de563890b 100644
--- a/server/services/subAgentSpawner.js
+++ b/server/services/subAgentSpawner.js
@@ -204,7 +204,10 @@ async function runInitSpawner() {
// the recovery sweep below refuses to adopt them.
if (!useRunner) {
setUseRunner(true);
- console.log('🔼 CoS Runner came up — promoting agent spawning from direct to runner mode');
+ // Through `emitLog`, like the disconnect warning above: both edges belong
+ // in the CoS log stream the UI reads, or a remote install sees the outage
+ // reported and never its resolution.
+ emitLog('info', '🔼 CoS Runner came up — promoting agent spawning from direct to runner mode');
recoverRunnerAgents().catch(err =>
console.error(`❌ Failed to recover runner agents after promotion: ${err.message}`)
);
diff --git a/server/services/subAgentSpawner.runnerPromotion.test.js b/server/services/subAgentSpawner.runnerPromotion.test.js
index 294289a671..0d70d93df9 100644
--- a/server/services/subAgentSpawner.runnerPromotion.test.js
+++ b/server/services/subAgentSpawner.runnerPromotion.test.js
@@ -54,6 +54,7 @@ vi.mock('fs', () => ({ existsSync: vi.fn().mockReturnValue(false) }));
import { initSpawner } from './subAgentSpawner.js';
import { initCosRunnerConnection } from './cosRunnerClient.js';
import { syncRunnerAgents } from './agentRunnerSync.js';
+import { emitLog } from './cosEvents.js';
import * as agentState from './agentState.js';
// Read through the module namespace: `useRunner` is reassigned by `setUseRunner`,
@@ -106,6 +107,16 @@ describe('subAgentSpawner — runner promotion (#4134)', () => {
expect(currentMode()).toBe(true);
});
+ it('announces the promotion on the CoS log stream, not just stdout', () => {
+ runnerHandlers.get('connection:ready')();
+
+ // The disconnect warning goes through emitLog, so the resolution must too —
+ // otherwise the UI shows an outage that never visibly ends.
+ const promotions = vi.mocked(emitLog).mock.calls.filter(([, message]) => /promoting/.test(message));
+ expect(promotions).toHaveLength(1);
+ expect(promotions[0][0]).toBe('info');
+ });
+
it('reconciles agents a runner that was already up owns, on promotion', () => {
runnerHandlers.get('connection:ready')();