fix(hook): suppress peer list when daemon is unreachable
Fold daemonError into SessionAnnounceOptions so the helper owns the mutually-exclusive choice between peer list and daemon-down hint. Before this fix, a session-announce against an unreachable daemon emitted both "No other mailboxes seen within the last 60 minutes (0 total registered)." (misleading — the daemon was never asked) AND the daemon-unreachable hint. Now only the hint appears when the daemon is down. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -260,8 +260,8 @@ program
|
||||
windowMinutes: opts.peerWindowMinutes,
|
||||
maxPeers: opts.maxPeers,
|
||||
watcherCommand: `claude-mailbox watch --block --name ${name}`,
|
||||
daemonError: daemonError ?? undefined,
|
||||
});
|
||||
if (daemonError) lines.push("", daemonError);
|
||||
lines.push("");
|
||||
process.stdout.write(lines.join("\n"));
|
||||
});
|
||||
|
||||
@@ -123,10 +123,11 @@ export interface SessionAnnounceOptions {
|
||||
windowMinutes: number;
|
||||
maxPeers: number;
|
||||
watcherCommand?: string;
|
||||
daemonError?: string;
|
||||
}
|
||||
|
||||
export function buildSessionAnnounceLines(opts: SessionAnnounceOptions): string[] {
|
||||
const { name, peers, windowMinutes, maxPeers, watcherCommand } = opts;
|
||||
const { name, peers, windowMinutes, maxPeers, watcherCommand, daemonError } = opts;
|
||||
const lines = [
|
||||
`Claude-Mailbox: your mailbox name this session is \`${name}\`.`,
|
||||
`The name is auto-derived as <project>-<session-short>. You can rename it (e.g. to tag your working area) with mcp__mailbox__rename(current_name="${name}", new_name="<project>-<area>-<short>"); after that, use the new name everywhere.`,
|
||||
@@ -151,7 +152,11 @@ export function buildSessionAnnounceLines(opts: SessionAnnounceOptions): string[
|
||||
` - exit code 2 → daemon unreachable; wait ~5 s, then relaunch.`,
|
||||
);
|
||||
}
|
||||
lines.push("", ...formatActivePeerList(peers, name, { windowMinutes, maxPeers }));
|
||||
if (daemonError) {
|
||||
lines.push("", daemonError);
|
||||
} else {
|
||||
lines.push("", ...formatActivePeerList(peers, name, { windowMinutes, maxPeers }));
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user