refactor(cli): drop CLAUDEMESH_SESSION_PRESENCE flag

per-session presence is small and uncomplicated enough that a rollback
flag isn't load-bearing. backwards compat is already covered at the
protocol layer — older brokers reply unknown_message_type to
session_hello and the SessionBrokerClient marks itself closed for that
mesh, which is the same outcome the flag would have given. removing
the flag, the helper, and the conditional from the registry hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-05-04 13:12:11 +01:00
parent f7d7d391c9
commit 6d981976c0
4 changed files with 16 additions and 29 deletions

View File

@@ -680,9 +680,8 @@ export async function runLaunch(flags: LaunchFlags, rawArgs: string[]): Promise<
sessionTokenForCleanup = minted.token;
// Per-session ephemeral keypair + parent attestation (1.30.0+).
// Behind CLAUDEMESH_SESSION_PRESENCE: the daemon ignores the
// presence material when the flag is off, so sending it always is
// forward-compatible.
// Older daemons ignore unknown body fields, so sending presence
// material always is forward-compatible.
let presencePayload: {
session_pubkey: string;
session_secret_key: string;

View File

@@ -28,18 +28,6 @@ export interface RunDaemonOptions {
clonePolicy?: ClonePolicy;
}
/**
* 1.30.0 feature flag. Default ON — the daemon opens a long-lived WS per
* registered session so siblings see each other in `peer list`. Set
* CLAUDEMESH_SESSION_PRESENCE=0 (or "false"/"off") to disable for
* rollback if the broker side is misbehaving on a given mesh.
*/
function isSessionPresenceEnabled(): boolean {
const v = process.env.CLAUDEMESH_SESSION_PRESENCE;
if (v === undefined || v === "") return true;
return v !== "0" && v.toLowerCase() !== "false" && v.toLowerCase() !== "off";
}
/** Detect a few common container environments to pick UDS-only by default. */
function detectContainer(): boolean {
if (process.env.KUBERNETES_SERVICE_HOST) return true;
@@ -167,14 +155,13 @@ export async function runDaemon(opts: RunDaemonOptions = {}): Promise<number> {
let drain: DrainHandle | null = null;
drain = startDrainWorker({ db: outboxDb, brokers });
// 1.30.0 — per-session broker presence. Default OFF for one release
// cycle so the broker side bakes before the flag flips. Opt-in via
// CLAUDEMESH_SESSION_PRESENCE=1; flips to default-on in 1.30.0 GA.
const sessionPresenceEnabled = isSessionPresenceEnabled();
// 1.30.0 — per-session broker presence. Always on. Older CLIs that
// don't include `presence` material in the register body just won't
// get a session WS; the daemon's own member-keyed broker still
// covers them.
const sessionBrokers = new Map<string, SessionBrokerClient>();
setRegistryHooks({
onRegister: (info) => {
if (!sessionPresenceEnabled) return;
if (!info.presence) return;
const meshConfig = meshConfigs.get(info.mesh);
if (!meshConfig) {