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: retain full sentinel summaries and match standalone markers

[._.]/ Adam Eivy638713c7d4e9
diff --git a/server/cos-runner/index.js b/server/cos-runner/index.js
index 1345abbfc9..6d470dab75 100644
--- a/server/cos-runner/index.js
+++ b/server/cos-runner/index.js
@@ -389,10 +389,10 @@ app.post('/spawn-tui', lifecycle.spawnRoute(async (req, res) => {
current.completedBySentinel = true;
const { summary } = parseSentinelPayload(validatedContents);
if (summary) {
- current.completionOutput = `${SENTINEL_COMPLETION_MARKER}\n${summary.slice(0, 4096)}\n`;
+ current.completionOutput = `${SENTINEL_COMPLETION_MARKER}\n${summary}\n`;
emitToServer('agent:output', {
agentId,
- text: current.completionOutput,
+ text: `${SENTINEL_COMPLETION_MARKER}\n${summary.slice(0, 4096)}\n`,
});
}
if (!current.exited) current.process.kill();
diff --git a/server/cos-runner/tuiExit.test.js b/server/cos-runner/tuiExit.test.js
index af283acc92..316154e83d 100644
--- a/server/cos-runner/tuiExit.test.js
+++ b/server/cos-runner/tuiExit.test.js
@@ -58,7 +58,7 @@ describe('runner TUI exit handoff', () => {
it('persists the sentinel received during exit instead of the Gemini thinking transcript', async () => {
const run = setup({ outputBuffer: 'Thinking: inspect the code and write the completion file.' });
- const summary = '✅ Agent signaled completion\n## Summary\nFixed the bug.\n';
+ const summary = `✅ Agent signaled completion\n## Summary\n${'Detailed results. '.repeat(400)}\nFinal conclusion.\n`;
run.agent.sentinelWork = Promise.resolve().then(() => {
run.agent.completedBySentinel = true;
run.agent.completionOutput = summary;
diff --git a/server/services/agentSummaryExtraction.js b/server/services/agentSummaryExtraction.js
index 55f6597eee..8cb37f690d 100644
--- a/server/services/agentSummaryExtraction.js
+++ b/server/services/agentSummaryExtraction.js
@@ -14,9 +14,10 @@ import { extractCodexAssistantTail } from '../lib/codexAssistantExtract.js';
// before transcript heuristics, which can mistake thinking or quoted commands
// for an assistant reply or a /simplify boundary.
function extractSentinelSummary(outputBuffer) {
- const markerIndex = outputBuffer.lastIndexOf(SENTINEL_COMPLETION_MARKER);
+ const lines = outputBuffer.split('\n');
+ const markerIndex = lines.findLastIndex(line => line.trim() === SENTINEL_COMPLETION_MARKER);
if (markerIndex < 0) return null;
- return stripLifecycleLines(outputBuffer.slice(markerIndex + SENTINEL_COMPLETION_MARKER.length).split('\n')).join('\n').trim() || null;
+ return stripLifecycleLines(lines.slice(markerIndex + 1)).join('\n').trim() || null;
}
/**
diff --git a/server/services/agentSummaryExtraction.test.js b/server/services/agentSummaryExtraction.test.js
index 8950379fb6..bd1a379912 100644
--- a/server/services/agentSummaryExtraction.test.js
+++ b/server/services/agentSummaryExtraction.test.js
@@ -4,7 +4,7 @@ import { extractFinalSummary, extractSimplifySummaries } from './agentSummaryExt
describe('sentinel summary precedence', () => {
it.each(['Thinking: I will now run /simplify.', 'tokens used\n123\nEarlier assistant reply.'])(
'renders the latest completion summary instead of transcript content: %s', (transcript) => {
- const summary = '## Summary\nFixed the reported bug.\n\n✅ Tests passed';
+ const summary = '## Summary\nFixed the reported bug.\n\nDocumented `✅ Agent signaled completion` behavior.\n✅ Tests passed';
const output = [
'✅ Agent signaled completion',
'An earlier completion attempt.',