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:
@@ -402,6 +402,20 @@ describe("buildSessionAnnounceLines", () => {
|
||||
expect(out).not.toContain("watch --block");
|
||||
expect(out).not.toContain("run_in_background");
|
||||
});
|
||||
|
||||
it("replaces the peer list with the daemonError hint when daemon is unreachable", () => {
|
||||
const out = buildSessionAnnounceLines({
|
||||
name: "alice-abc12345",
|
||||
peers: [],
|
||||
windowMinutes: 60,
|
||||
maxPeers: 10,
|
||||
daemonError: "[Claude-Mailbox] Daemon not reachable at http://127.0.0.1:1.",
|
||||
}).join("\n");
|
||||
expect(out).toContain("Daemon not reachable");
|
||||
// The misleading "no peers" line must NOT appear when the daemon is down.
|
||||
expect(out).not.toMatch(/No other mailboxes seen/);
|
||||
expect(out).not.toMatch(/Active peers/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("readSettings / writeSettings roundtrip", () => {
|
||||
|
||||
Reference in New Issue
Block a user