Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/cli/commands/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function registerAgentCommands(program: Command): void {
} catch (err) {
if (!(err instanceof IdentityError)) throw err;
}
if (agent) await getStore().heartbeat(agent, undefined, undefined, getDeclaredSessionId() ?? undefined);
if (agent) await getStore().heartbeat(agent);

const agentsList = await getStore().listAgents({ online_only: opts.online });
const sort = getStore().describeListOrder("agents");
Expand Down Expand Up @@ -343,12 +343,7 @@ export function registerAgentCommands(program: Command): void {
.action(async (opts) => {
const agent = resolveIdentity(opts.from);
const status = opts.status || "online";
// Attribute the refresh to the session that actually made it. Without the
// session id the store takes its COALESCE branch and keeps whichever
// session registered the agent, so last_seen_at advances while session_id
// still names a session that has not written since — a row that asserts
// the wrong author rather than merely omitting one.
await getStore().heartbeat(agent, status, undefined, getDeclaredSessionId() ?? undefined);
await getStore().heartbeat(agent, status);

if (opts.json) {
printJsonLine({ agent, status, heartbeat: true });
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Command } from "commander";
import { getStore } from "../../lib/store/index.js";
import chalk from "chalk";
import { getDbPath, closeDb } from "../../lib/db.js";
import { getDeclaredSessionId, resolveIdentity } from "../../lib/identity.js";
import { resolveIdentity } from "../../lib/identity.js";
import { windowItems } from "../../lib/compact-output.js";
import { storeStatusLocation, type StoreStatusLocation } from "../../lib/store/status-location.js";
import { checkForUpdate } from "../../lib/version-check.js";
Expand Down Expand Up @@ -201,7 +201,7 @@ export function registerAnalyticsCommands(program: Command): void {
.action(async (opts) => {
const agent = resolveIdentity();
const store = getStore();
await store.heartbeat(agent, undefined, undefined, getDeclaredSessionId() ?? undefined);
await store.heartbeat(agent);
const window = getCliWindow({ limit: opts.limit });

// Online agents
Expand Down
6 changes: 3 additions & 3 deletions src/cli/commands/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import chalk from "chalk";
import { normalizeSince } from "../../lib/since.js";
// Reads/writes route through getStore(): ApiStore (self_hosted/cloud) or LocalStore.
import { closeDb } from "../../lib/db.js";
import { getDeclaredSessionId, resolveIdentities, resolveIdentity } from "../../lib/identity.js";
import { resolveIdentities, resolveIdentity } from "../../lib/identity.js";
import { renderContent } from "../../lib/terminal-markdown.js";
import { buildMessagePreview } from "../../lib/channel-notifications.js";
import { readChannelNotificationsUnion } from "../../lib/poll-notifications.js";
Expand Down Expand Up @@ -803,7 +803,7 @@ channel, which is an ABSENCE claim.
.option("-j, --json", "Output as JSON")
.action(async (opts) => {
const agent = resolveIdentity(opts.from);
await getStore().heartbeat(agent, undefined, undefined, getDeclaredSessionId() ?? undefined);
await getStore().heartbeat(agent);

if (opts.clear) {
const cleared = await getStore().markAllChannelNotificationsRead(agent, opts.channel);
Expand Down Expand Up @@ -859,7 +859,7 @@ channel, which is an ABSENCE claim.
const identities = resolveIdentities(opts.from);
const agent = identities[0];
const store = getStore();
await store.heartbeat(agent, undefined, undefined, getDeclaredSessionId() ?? undefined);
await store.heartbeat(agent);
const selfSenderIds = new Set<string>();
for (const identity of identities) {
selfSenderIds.add(identity);
Expand Down
169 changes: 0 additions & 169 deletions src/cli/heartbeat-session-provenance.e2e.test.ts

This file was deleted.

Loading
Loading