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

Clarify bounded completion and issue disposition in TUI stall nudges (#11522)

[._.]/778266165c5c
diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.js
index 6268c77524..c88d100033 100644
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@ -1690,8 +1690,8 @@ export function createToolPermissionGate() {
// model narrates its next step ("Next: /do:pr"), ends its turn, and the TUI
// returns to its idle composer. The run is not finished, the sentinel is not
// written, and — since the wall-clock ceiling was removed — nothing else in the
-// unattended path will ever touch that session again. A human dropping into the
-// Shell tab and typing `continue` recovers it every time; this gate types it.
+// unattended path will ever touch that session again. This gate asks it to
+// finish the bounded work and record its verified outcome through the sentinel.
//
// Unlike the OOM and tool-permission gates, there is nothing to ARM on: the
// condition IS the silence, so this one is poll-only. That also makes the
@@ -1732,10 +1732,15 @@ export const STALL_NUDGE_MAX_ATTEMPTS = 3;
// never runs out and the run loops for hours on a local GPU. A run that has
// needed this many nudges is not going to finish on the next one.
export const STALL_NUDGE_MAX_TOTAL = 6;
-// What gets pasted. The same word a human types into the Shell tab: the TUI
-// still holds the conversation, and the unattended-run rules already live in
-// the prompt. A longer paste only clutters the composer.
-export const STALL_NUDGE_TEXT = 'continue';
+// The original prompt still owns scope, publication authority, and the exact
+// sentinel contract. Recovery asks for an honest disposition, not a success.
+export const STALL_NUDGE_TEXT = [
+ 'Finish what you can and then write the completion sentinel. File GitHub issues for anything that is too big for this session.',
+ 'Stay within the original task scope, permissions, and safety limits; do not bypass a refusal or permission block.',
+ 'Follow the owning repository\'s issue-filing instructions: search for duplicates and reuse an existing issue, or file an actionable issue with redacted evidence, affected paths, a chosen next step, and acceptance criteria.',
+ 'If issue filing is not authorized, unavailable, or fails, report the filing blocker and ready-to-file details as an INCOMPLETE disposition; do not claim it was filed.',
+ 'Use the exact sentinel path and format from your existing completion instructions. Summarize verified work, checks, issue links, unresolved work, and blockers honestly; writing the sentinel does not itself mean the task succeeded.',
+].join(' ');
/**
* State machine for "nudge a TUI session that stopped mid-task".
diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.js
index 1c54428e30..fbfcaa54ba 100644
--- a/server/lib/tuiHandshake.test.js
+++ b/server/lib/tuiHandshake.test.js
@@ -21,7 +21,6 @@ import {
STALL_NUDGE_IDLE_MS,
STALL_NUDGE_RECOVERY_MS,
STALL_NUDGE_MAX_ATTEMPTS,
- STALL_NUDGE_TEXT,
SELF_CLEARING_RESUBMIT_INTERVAL_MS,
SELF_CLEARING_RESUBMIT_ECHO_MS,
MCP_BOOT_PASTE_DEADLINE_MS,
@@ -2078,12 +2077,6 @@ describe('answerStartupDialogs', () => {
});
describe('createStallNudgeGate', () => {
- it('pastes the word a human types, not a paragraph', () => {
- // A long explanation restates rules the prompt already carries and crowds
- // the composer. The resume a human types is the single word.
- expect(STALL_NUDGE_TEXT).toBe('continue');
- });
-
it('nudges a session that went quiet with its task unfinished', () => {
const gate = createStallNudgeGate();
const quietSince = 0;
diff --git a/server/services/agentTuiSpawning.test.js b/server/services/agentTuiSpawning.test.js
index 2410ef955b..14e317fe24 100644
--- a/server/services/agentTuiSpawning.test.js
+++ b/server/services/agentTuiSpawning.test.js
@@ -2136,7 +2136,7 @@ describe('spawnTuiAgent runtime', () => {
// screen for a detector to match and — since the wall-clock ceiling was
// removed — nothing would ever have touched it again. A human opened the Shell
// tab and typed "continue", and it finished.
- it("nudges a session that went quiet with the task unfinished", async () => {
+ it('dispatches bounded completion and issue-disposition guidance to a stalled session', async () => {
await driveAgyToSubmittedPrompt();
vi.mocked(shellService.pasteToSession).mockClear();
@@ -2149,9 +2149,23 @@ describe('spawnTuiAgent runtime', () => {
await flushMicrotasks();
expect(shellService.pasteToSession).toHaveBeenCalledWith(
SESSION_ID,
- STALL_NUDGE_TEXT,
+ expect.stringContaining('Finish what you can and then write the completion sentinel.'),
expect.objectContaining({ label: expect.stringContaining("stalled") }),
);
+ // Assert what the recovery boundary actually sends, independently of the
+ // shared constant, so reverting it to a generic "continue" is caught here.
+ const recoveryText = vi.mocked(shellService.pasteToSession).mock.calls[0][1];
+ expect(recoveryText).toContain('File GitHub issues for anything that is too big for this session.');
+ expect(recoveryText).toContain('original task scope, permissions, and safety limits');
+ expect(recoveryText).toContain('do not bypass a refusal or permission block');
+ expect(recoveryText).toContain('owning repository\'s issue-filing instructions');
+ expect(recoveryText).toContain('search for duplicates and reuse an existing issue');
+ expect(recoveryText).toContain('redacted evidence, affected paths, a chosen next step, and acceptance criteria');
+ expect(recoveryText).toContain('If issue filing is not authorized, unavailable, or fails');
+ expect(recoveryText).toContain('report the filing blocker and ready-to-file details as an INCOMPLETE disposition');
+ expect(recoveryText).toContain('do not claim it was filed');
+ expect(recoveryText).toContain('exact sentinel path and format from your existing completion instructions');
+ expect(recoveryText).toContain('writing the sentinel does not itself mean the task succeeded');
// A nudge, never a verdict: the run carries on.
expect(shellService.pasteToSession).toHaveBeenCalledTimes(1);
expect(agentLifecycle.finalizeAgent).not.toHaveBeenCalled();
diff --git a/server/services/agentTuiSpawning/sessionController.js b/server/services/agentTuiSpawning/sessionController.js
index 4d09a75b79..7536176383 100644
--- a/server/services/agentTuiSpawning/sessionController.js
+++ b/server/services/agentTuiSpawning/sessionController.js
@@ -1461,8 +1461,8 @@ export function createTuiSessionController({
// resume and the ordinary paste path still owns first delivery.
if (agyResumeGate && promptSubmittedAt) {
agyResumeGate.observe(stripped);
- // A relaunched agy is up once its composer footer paints; only then is a
- // "continue" a message to the model rather than keystrokes into a boot.
+ // A relaunched agy is up once its composer footer paints; only then is the
+ // completion request a message to the model rather than boot keystrokes.
if (agyResumeAwaitingComposer && AGY_INPUT_READY_PATTERN.test(stripped)) {
agyResumeAwaitingComposer = false;
if (pasteController?.resubmit({ text: STALL_NUDGE_TEXT, label: 'agy resume nudge' })) {