Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Merge batch 11-03 b1832: #2786 (#2801)

0xken155beced66aa9b
diff --git a/cli/src/engines/claude/__fixtures__/renamed-session-2.1.317-120.txt b/cli/src/engines/claude/__fixtures__/renamed-session-2.1.317-120.txt
new file mode 100644
index 000000000..b70a5cd10
--- /dev/null
+++ b/cli/src/engines/claude/__fixtures__/renamed-session-2.1.317-120.txt
@@ -0,0 +1,40 @@
+ ▐▛███▛█ Claude Code v2.1.317
+▝▜██████▀ Haiku 5.5 · Claude Ultra
+ ▝▝ ▝▝ ~/scratch/rename
+
+▎ Your Ultra plan includes $200 a month in API credits to power your apps and agents. Claim them at
+▎ https://clau.de/api-credits
+
+❯ /rename my-renamed-buddy
+ ⎿ Session renamed to: my-renamed-buddy
+
+───────────────────────────────────────────────────────────────────────────────────────────────────── my-renamed-buddy ─
+❯ 
+────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+ ⏵⏵ auto mode on (shift+tab to cycle)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cli/src/engines/claude/__fixtures__/renamed-session-2.1.317-60.txt b/cli/src/engines/claude/__fixtures__/renamed-session-2.1.317-60.txt
new file mode 100644
index 000000000..511874c8c
--- /dev/null
+++ b/cli/src/engines/claude/__fixtures__/renamed-session-2.1.317-60.txt
@@ -0,0 +1,40 @@
+ ▐▛███▛█ Claude Code v2.1.317
+▝▜██████▀ Haiku 5.5 · Claude Ultra
+ ▝▝ ▝▝ ~/scratch/rename
+
+▎ Your Ultra plan includes $200 a month in API credits to
+▎ power your apps and agents. Claim them at
+▎ https://clau.de/api-credits
+
+❯ /rename my-renamed-buddy
+ ⎿ Session renamed to: my-renamed-buddy
+
+───────────────────────────────────────── my-renamed-buddy ─
+❯ 
+────────────────────────────────────────────────────────────
+ ⏵⏵ auto mode on (shift+tab to cycle)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cli/src/engines/claude/composer.ts b/cli/src/engines/claude/composer.ts
index 9552edbed..59175842a 100644
--- a/cli/src/engines/claude/composer.ts
+++ b/cli/src/engines/claude/composer.ts
@@ -2,8 +2,13 @@ import type { ComposerState } from '../facets/screen.js'
import { screenLines, typedToken } from '../kit/composer.js'
import { claudeWindowsComposer } from '../kit/pane.js'
-/** A row of Claude Code's rule: all `─`, or `─` at both ends with text set in it. */
-const CLAUDE_RULE = /^─{3,}$|^─{3,}.*─{3,}$/
+/**
+ * A row of Claude Code's rule: all `─`, or `─` at both ends with text set in it. After `/rename`, Claude Code sets the
+ * session's name in the prompt box's top rule with a single `─` after it (`───…─── my-renamed-buddy ─`, 2.1.317): read as
+ * no rule, the box was never found, and every Swarm message to that Buddy was held as `prompt_hidden` while typing by hand
+ * still worked (task #2428, 2026-11-03). So three at the start, and one at the end.
+ */
+export const CLAUDE_RULE = /^─{3,}(?:.*─)?$/
export function composerState(capture: string): ComposerState {
const { lines } = screenLines(capture)
diff --git a/cli/src/engines/claude/renamedSession.spec.ts b/cli/src/engines/claude/renamedSession.spec.ts
new file mode 100644
index 000000000..f7d653ca7
--- /dev/null
+++ b/cli/src/engines/claude/renamedSession.spec.ts
@@ -0,0 +1,78 @@
+import { readFileSync } from 'node:fs'
+import { afterEach, describe, expect, it } from 'vitest'
+import { composerState } from './composer.js'
+import { screen } from './screen.js'
+
+/**
+ * Task #2428 (reported 11-03): a person renamed their Buddy's Claude Code session with Claude Code's own `/rename`, and
+ * from then on no chat message reached it, while typing in its terminal still worked. Claude Code then sets the session's
+ * name in its prompt box's top rule, the name and one `─` after it. These are real panes of Claude Code 2.1.317 after
+ * `/rename my-renamed-buddy`, read with tmux at 120 and 60 columns.
+ */
+const fixture = (width: number) => readFileSync(new URL(`./__fixtures__/renamed-session-2.1.317-${width}.txt`, import.meta.url), 'utf8')
+const renamed = [fixture(120), fixture(60)]
+
+const platform = Object.getOwnPropertyDescriptor(process, 'platform')!
+const on = (name: NodeJS.Platform) => Object.defineProperty(process, 'platform', { ...platform, value: name })
+afterEach(() => { Object.defineProperty(process, 'platform', platform) })
+
+/** [capture] with [draft] typed after its last `❯`. */
+const typed = (capture: string, draft: string) => {
+ const lines = capture.split('\n')
+ const at = lines.findLastIndex(line => line.startsWith('❯'))
+ lines[at] = `❯ ${draft}`
+ return lines.join('\n')
+}
+
+describe('a Claude Code session renamed with /rename', () => {
+ it('the captures show the titled rule this reads', () => {
+ for (const capture of renamed) expect(capture).toMatch(/^─{3,} my-renamed-buddy ─$/m)
+ })
+
+ it('takes a Swarm message: its prompt box is found, nothing holds the delivery', () => {
+ for (const capture of renamed) {
+ expect(composerState(capture)).toBe('ready')
+ expect(screen.inspect(capture)).toMatchObject({ messageHold: null, teamHold: null, question: null })
+ }
+ })
+
+ it('still sees what the person typed there as a draft, and a slash popup as a popup', () => {
+ for (const capture of renamed) {
+ expect(composerState(typed(capture, 'half a thought'))).toBe('ready')
+ expect(screen.inspect(typed(capture, 'half a thought')).teamHold).toBe('team_waiting_draft')
+ const popup = typed(capture, '/mo').replace(/\n ⏵⏵ auto mode on.*$/m, '\n /model Set the AI model for Claude Code')
+ expect(composerState(popup)).toBe('popup')
+ }
+ })
+
+ it('reads a dialog Claude Code draws ruled under the renamed box as no prompt', () => {
+ for (const capture of renamed) {
+ const dialog = capture.replace(/\n ⏵⏵ auto mode on.*$/m, `\n${'─'.repeat(40)}\n Do you want to proceed?\n ❯ 1. Yes\n 2. No`)
+ expect(composerState(dialog)).toBe('absent')
+ }
+ })
+
+ // The takeover reader found the prompt only under a plain rule; under the titled one it looked for a dialog anywhere on
+ // the screen, so the trust question's words quoted in the transcript above read as the trust dialog open.
+ it('never reads the trust question quoted above the renamed box as a dialog in front of it', () => {
+ const quoted = ['⏺ The first screen asked:', ' Quick safety check: Is this a project you created or one you trust?',
+ ' ❯ No, exit', ' Yes, I trust this folder', '']
+ for (const capture of renamed) {
+ const at = capture.indexOf('❯ /rename')
+ const shown = capture.slice(0, at) + quoted.join('\n') + capture.slice(at)
+ expect(screen.inspect(shown)).toMatchObject({ messageHold: null })
+ }
+ })
+
+ // Claude Code draws `>` for its marker in the Harness terminal on Windows (kit/pane.ts `claudeWindowsComposer`).
+ it('on Windows, finds the `>` composer under the titled rule too', () => {
+ on('win32')
+ for (const capture of renamed) {
+ // Claude Code draws a no-break space after its marker; the person's earlier `❯ /rename` row stays in the transcript.
+ const windows = capture.replace(/^❯\u00a0$/m, '>\u00a0')
+ expect(windows).not.toMatch(/^❯\u00a0$/m)
+ expect(composerState(windows)).toBe('ready')
+ expect(screen.inspect(windows)).toMatchObject({ messageHold: null, teamHold: null })
+ }
+ })
+})
diff --git a/cli/src/engines/claude/screen.ts b/cli/src/engines/claude/screen.ts
index 5602bfe6f..ac9ca7d07 100644
--- a/cli/src/engines/claude/screen.ts
+++ b/cli/src/engines/claude/screen.ts
@@ -3,7 +3,7 @@ import type { EngineScreen, PaneTakeover, PaneView } from '../facets/screen.js'
import { inspectPane, paneModal as readModal, stripAnsi } from '../kit/pane.js'
import { locateQuestionPane } from '../kit/questionPane.js'
import { assembleScreen } from '../kit/screen.js'
-import { composerState } from './composer.js'
+import { CLAUDE_RULE, composerState } from './composer.js'
export function questionPane(capture: string): PaneView {
const found = locateQuestionPane(capture)
@@ -20,7 +20,10 @@ export const screen: EngineScreen = {
function takeover(capture: string): PaneTakeover | null {
const lines = stripAnsi(capture).replace(/\u00a0/g, ' ').split('\n')
const bottom = lines.filter(line => line.trim()).slice(-3)
- const composer = lines.findLastIndex((line, index) => /^\s*❯/.test(line) && index > 0 && /^\s*[─━]{8,}\s*$/.test(lines[index - 1]))
+ // Under a titled rule too (a session renamed with `/rename`, composer.ts): with no composer found, every dialog's words
+ // were looked for anywhere on the screen, the transcript above the prompt included (task #2428).
+ const composer = lines.findLastIndex((line, index) => /^\s*❯/.test(line) && index > 0
+ && (/^\s*[─━]{8,}\s*$/.test(lines[index - 1]) || CLAUDE_RULE.test(lines[index - 1].trim())))
const shown = (...patterns: RegExp[]) => patterns.every(pattern => lines.findLastIndex(line => pattern.test(line)) > composer)
if (claudeRewindMenuOpen(capture)) return 'rewind'
if (bottom.some((line) => CLAUDE_TRANSCRIPT_FOOTER.test(line))) return 'transcript'
diff --git a/cli/src/engines/kit/pane.ts b/cli/src/engines/kit/pane.ts
index bc10073bb..ddd37bce6 100644
--- a/cli/src/engines/kit/pane.ts
+++ b/cli/src/engines/kit/pane.ts
@@ -213,7 +213,8 @@ function promptMarker(engine: AgentEngine): RegExp {
return /[›❯]/u
}
-const COMPOSER_RULE = /^[─━]{3,}(?:.*[─━]{3,})?\s*$/
+/** One `─` may end it: Claude Code's top rule after `/rename` is `───…─── name ─` (claude/composer.ts, task #2428). */
+const COMPOSER_RULE = /^[─━]{3,}(?:.*[─━])?\s*$/
/** A row only Claude Code's own footer draws: its shortcut hint, or its permission mode with the key that cycles it. Claude
* Code cuts the row at the pane's width, so its start is enough: a mode's `⏵⏵`/`⏸`, or `? for sh…`. A 42-column pane on
* DESKTOP-0TFH0OJ (2026-10-26) showed `⏵⏵ bypass permissions on (shift+tab to`, its composer read as absent, and every
diff --git a/desktop/lib/super_tabs/buddies.dart b/desktop/lib/super_tabs/buddies.dart
index 83404948f..0c859f014 100644
--- a/desktop/lib/super_tabs/buddies.dart
+++ b/desktop/lib/super_tabs/buddies.dart
@@ -337,7 +337,7 @@ Future<void> confirmRemoveBuddy(
) async {
final remove = await showAppDialog<bool>(
context: context,
- builder: (context) => SuperTabDialogScope(
+ builder: (context) => _BuddyDialogScope(
controller: c,
projectId: projectId,
child: AlertDialog(
@@ -382,13 +382,41 @@ Future<void> showRenameBuddy(
String projectId,
) => showAppDialog<void>(
context: context,
- builder: (context) => SuperTabDialogScope(
+ builder: (context) => _BuddyDialogScope(
controller: c,
projectId: projectId,
child: _RenameBuddyDialog(controller: c, projectId: projectId),
),
);
+/// A Buddy dialog's scope: its project while the project is there, or the
+/// one Buddy's chat while that is there. The one Buddy belongs to no project
+/// (its key is [SuperTabController.kSwarmBuddyKey]), so a scope that wanted a
+/// project showed "This action is no longer available." in place of Rename
+/// Buddy and Remove Buddy (task #2428, 11-03).
+class _BuddyDialogScope extends StatelessWidget {
+ const _BuddyDialogScope({
+ required this.controller,
+ required this.projectId,
+ required this.child,
+ });
+
+ final SuperTabController controller;
+ final String projectId;
+ final Widget child;
+
+ @override
+ Widget build(BuildContext context) {
+ final swarm = projectId == SuperTabController.kSwarmBuddyKey;
+ return SuperTabDialogScope(
+ controller: controller,
+ projectId: swarm ? null : projectId,
+ conversationId: swarm ? controller.buddyChat(projectId)?.id : null,
+ child: child,
+ );
+ }
+}
+
class _RenameBuddyDialog extends StatefulWidget {
const _RenameBuddyDialog({required this.controller, required this.projectId});
final SuperTabController controller;
diff --git a/desktop/test/super_tab_one_buddy_test.dart b/desktop/test/super_tab_one_buddy_test.dart
index ec7f7342f..d91ce02d6 100644
--- a/desktop/test/super_tab_one_buddy_test.dart
+++ b/desktop/test/super_tab_one_buddy_test.dart
@@ -209,6 +209,68 @@ void main() {
);
});
+ // Task #2428 (reported 11-03): Rename Buddy and Remove Buddy on the one
+ // Buddy showed "This action is no longer available." in place of either
+ // dialog. Their scope wanted the chat's project to exist, and the one
+ // Buddy's chat is in none (its project id is the empty key).
+ group('Rename Buddy and Remove Buddy on the one Buddy', () {
+ const unavailable = 'This action is no longer available.';
+
+ testWidgets('Rename Buddy opens its dialog and names the Buddy', (
+ tester,
+ ) async {
+ final server = oneBuddySwarm();
+ giveSwarmBuddy(server);
+ final c = await show(tester, server);
+ await openMenu(tester);
+ await tester.tap(find.text('Rename Buddy…'));
+ await tester.pumpAndSettle();
+
+ expect(find.text(unavailable), findsNothing);
+ expect(find.text('Rename your Buddy'), findsOneWidget);
+ await tester.enterText(
+ find.byKey(const ValueKey('super-buddy-name')),
+ 'Sparky',
+ );
+ await tester.tap(find.widgetWithText(FilledButton, 'Save'));
+ await tester.pumpAndSettle();
+
+ expect(commands(server, 'buddy.rename'), [
+ {
+ 'type': 'buddy.rename',
+ 'conversationId': 'swarm-buddy-peer',
+ 'name': 'Sparky',
+ },
+ ]);
+ expect(find.text('Rename your Buddy'), findsNothing);
+ await close(tester, c);
+ });
+
+ testWidgets('Remove Buddy asks first, then removes it naming no project', (
+ tester,
+ ) async {
+ final server = oneBuddySwarm();
+ giveSwarmBuddy(server);
+ final c = await show(tester, server);
+ await openMenu(tester);
+ await tester.tap(find.text('Remove Buddy'));
+ await tester.pumpAndSettle();
+
+ expect(find.text(unavailable), findsNothing);
+ expect(find.text('Remove Buddy?'), findsOneWidget);
+ expect(commands(server, 'buddy.remove'), isEmpty);
+ await tester.tap(find.widgetWithText(FilledButton, 'Remove'));
+ await tester.pumpAndSettle();
+
+ expect(commands(server, 'buddy.remove'), [
+ {'type': 'buddy.remove'},
+ ]);
+ expect(c.buddy(SuperTabController.kSwarmBuddyKey), isNull);
+ expect(c.buddyChat(SuperTabController.kSwarmBuddyKey), isNotNull);
+ await close(tester, c);
+ });
+ });
+
group('older project Buddy chats', () {
testWidgets('are listed in the one chat\'s menu and open read only', (
tester,
diff --git a/docs/plans/2026-11-03-buddy-rename-delivery-plan.md b/docs/plans/2026-11-03-buddy-rename-delivery-plan.md
new file mode 100644
index 000000000..fcb2a83ae
--- /dev/null
+++ b/docs/plans/2026-11-03-buddy-rename-delivery-plan.md
@@ -0,0 +1,83 @@
+# Buddy /rename keeps chat delivery Implementation Plan
+
+> Way of working: this project's Engineer workflow (instructions, Engineer role): one Engineer implements every task test
+> first in this session, committing each failing test before its code; the Review step on the pull request is the one
+> independent review. No execution handoff.
+
+**Goal:** After a person renames their Buddy's Claude Code session with `/rename`, chat messages still reach it, and its
+Rename Buddy / Remove Buddy actions in the app work.
+
+**Architecture:** Two independent defects, found by reproducing on a scratch Claude Code 2.1.317 session in a private
+tmux server (no Buddy touched):
+
+1. CLI. `/rename my-renamed-buddy` makes Claude Code draw the prompt box's top rule as
+ `───…─── my-renamed-buddy ─`: the name, then one `─`. Harness's Claude screen reader takes a rule with text in it only
+ with three or more `─` on both sides (`engines/claude/composer.ts` `CLAUDE_RULE`), so it finds no prompt box, reads
+ the composer as `absent`, and every Swarm delivery is held as `prompt_hidden` (the backend cancels it as Not sent
+ after an hour, deliverySettle.ts `HOLD_LIMIT_MS`). Typing by hand still works, which matches the report. The same
+ strict shape is in the Windows composer finder (`engines/kit/pane.ts` `COMPOSER_RULE`) and in the takeover reader's
+ composer (`engines/claude/screen.ts`, a plain rule only), whose miss makes it look for a trust or sign-in dialog
+ anywhere on screen instead of below the prompt. One shared titled-rule pattern fixes all three.
+2. Desktop. The Rename Buddy and Remove Buddy dialogs are wrapped in `SuperTabDialogScope(projectId: group.projectId)`.
+ The one Buddy per Swarm (spec 2026-10-31-one-buddy-per-swarm) belongs to no project: its chat's `projectId` is `''`
+ (`kSwarmBuddyKey`), no project has that id, and the scope shows "This action is no longer available." in place of
+ either dialog. Unrelated to `/rename`; the reporter met it in the same session. The scope is given no project for the
+ Swarm Buddy and is tied to the Buddy chat instead.
+
+Recovery: the reader runs on each delivery attempt, so a Buddy already cut off takes messages again as soon as its
+machine runs the fixed CLI, without being recreated or restarted. Messages already cancelled stay Not sent.
+
+**Tech Stack:** TypeScript (vitest) in `cli/`, Dart/Flutter (flutter_test) in `desktop/`.
+
+**Spec:** Task #2428 brief (conversation acfd840fed9ef0d72ca314f4) and River's follow-up on rename/remove.
+
+## Global Constraints
+
+- PR body first line: "Requested by [email protected] through Harness."
+- Swarm code stays out of cli/src/core. Never a test that signs the Mac out of the real CLI (Desktop: memory store, fake sign-in).
+- Reproduce on throwaway sessions only, never on a person's real Buddy.
+
+## Review Focus
+
+- A long name at a narrow width: Claude Code still ends the rule with ` ─`; the pattern needs `─{3,}` at the start and `─` at the end only.
+- Output in the transcript that starts at column 0 with `───` and ends in `─` must not become a second prompt box: only the rule directly above the last `❯` row counts, as before.
+- A dialog drawn under the renamed box (Claude Code draws its own dialogs ruled) still reads as `absent`.
+- Windows `>` composer under a titled rule reads as ready.
+- The project Buddy (older chat in a project) keeps its project check in the dialog scope.
+
+---
+
+### Task 1: Claude Code's titled rule after /rename (CLI)
+
+**Files:**
+- Test: `cli/src/engines/claude/renamedSession.spec.ts` (new; the real 2.1.317 captures at 120 and 60 columns)
+- Modify: `cli/src/engines/claude/composer.ts` (`CLAUDE_RULE`, exported), `cli/src/engines/claude/screen.ts` (takeover composer), `cli/src/engines/kit/pane.ts` (`COMPOSER_RULE`)
+
+**Interfaces:**
+- Produces: `export const CLAUDE_RULE: RegExp` in `engines/claude/composer.ts`: `^─{3,}$` or `─{3,}` at the start and `─` at the end.
+
+- [ ] **Step 1: Write the failing test** — `screen.inspect(renamedCapture)` gives `messageHold: null` and `teamHold: null`;
+ `composerState` is `'ready'`, `'ready'` with a draft (and `teamHold` `'team_waiting_draft'`), `'absent'` with a ruled
+ dialog under the box; on `win32`, a `>` composer under the titled rule is `'ready'`; a renamed screen whose
+ scrollback quotes the trust prompt's lines gives no `trust_open` hold.
+- [ ] **Step 2: Run** `npx vitest run src/engines/claude/renamedSession.spec.ts` — Expected: FAIL (`prompt_hidden`).
+- [ ] **Step 3: Implement** the shared `CLAUDE_RULE` and use it in the three readers.
+- [ ] **Step 4: Run** the new spec and `src/engines` — Expected: PASS.
+- [ ] **Step 5: Commit** test, then code.
+
+### Task 2: Rename Buddy / Remove Buddy for the Swarm Buddy (Desktop)
+
+**Files:**
+- Test: `desktop/test/super_tabs/buddy_dialogs_test.dart` (new, memory store and fake sign-in via the Super Tab fixture)
+- Modify: `desktop/lib/super_tabs/buddies.dart` (`confirmRemoveBuddy`, `showRenameBuddy`)
+
+**Interfaces:**
+- Consumes: `SuperTabController.kSwarmBuddyKey`, `SuperTabController.buddyChat(projectId)`.
+
+- [ ] **Step 1: Write the failing test** — with a Swarm Buddy (`swarmBuddy: true`, a `swarm-buddy` chat), opening Rename
+ Buddy shows its name field and saving sends `buddy.rename`; opening Remove Buddy shows "Remove Buddy?" and Remove
+ sends `buddy.remove`; neither shows "This action is no longer available."
+- [ ] **Step 2: Run** `flutter test test/super_tabs/buddy_dialogs_test.dart` — Expected: FAIL (the unavailable dialog).
+- [ ] **Step 3: Implement** — pass `projectId` only when it is not `kSwarmBuddyKey`, and `conversationId` of the Buddy chat.
+- [ ] **Step 4: Run** the test and the existing Buddy tests — Expected: PASS.
+- [ ] **Step 5: Commit** test, then code.