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
12 changes: 8 additions & 4 deletions plugins/telegram-agy/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,11 +1036,15 @@ async function restartAgent(name: string, ackUpdateId?: number): Promise<void> {
try { await bot.api.getUpdates({ offset: ackUpdateId + 1, limit: 1, timeout: 0 }) } catch {}
}
await new Promise<void>(resolve => {
// `sudo 5dive agent restart <name>` is the canonical path — it
// touches the systemd unit, not the tmux session directly, so the
// unit's audit log and restart counter stay consistent.
// DIVE-1813: `sudo 5dive agent _self_restart` is the canonical path — on a
// standard-isolation box the agent's scoped sudoers grants exactly this
// (there is NO `agent restart <name>` grant), and it restarts ONLY the
// caller's own unit (derived from SUDO_USER, never argv). Deferred
// internally so the ack lands before the respawn. Touches the systemd unit,
// not the tmux session, so the unit's audit log + restart counter stay
// consistent.
require('child_process').execFile('sudo',
['-n', '5dive', 'agent', 'restart', name],
['-n', '5dive', 'agent', '_self_restart'],
{ timeout: 10_000 },
() => resolve(),
)
Expand Down
12 changes: 8 additions & 4 deletions plugins/telegram-codex/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1063,11 +1063,15 @@ async function restartAgent(name: string, ackUpdateId?: number): Promise<void> {
try { await bot.api.getUpdates({ offset: ackUpdateId + 1, limit: 1, timeout: 0 }) } catch {}
}
await new Promise<void>(resolve => {
// `sudo 5dive agent restart <name>` is the canonical path — it
// touches the systemd unit, not the tmux session directly, so the
// unit's audit log and restart counter stay consistent.
// DIVE-1813: `sudo 5dive agent _self_restart` is the canonical path — on a
// standard-isolation box the agent's scoped sudoers grants exactly this
// (there is NO `agent restart <name>` grant), and it restarts ONLY the
// caller's own unit (derived from SUDO_USER, never argv). Deferred
// internally so the ack lands before the respawn. Touches the systemd unit,
// not the tmux session, so the unit's audit log + restart counter stay
// consistent.
require('child_process').execFile('sudo',
['-n', '5dive', 'agent', 'restart', name],
['-n', '5dive', 'agent', '_self_restart'],
{ timeout: 10_000 },
() => resolve(),
)
Expand Down
12 changes: 8 additions & 4 deletions plugins/telegram-grok/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1048,11 +1048,15 @@ async function restartAgent(name: string, ackUpdateId?: number): Promise<void> {
try { await bot.api.getUpdates({ offset: ackUpdateId + 1, limit: 1, timeout: 0 }) } catch {}
}
await new Promise<void>(resolve => {
// `sudo 5dive agent restart <name>` is the canonical path — it
// touches the systemd unit, not the tmux session directly, so the
// unit's audit log and restart counter stay consistent.
// DIVE-1813: `sudo 5dive agent _self_restart` is the canonical path — on a
// standard-isolation box the agent's scoped sudoers grants exactly this
// (there is NO `agent restart <name>` grant), and it restarts ONLY the
// caller's own unit (derived from SUDO_USER, never argv). Deferred
// internally so the ack lands before the respawn. Touches the systemd unit,
// not the tmux session, so the unit's audit log + restart counter stay
// consistent.
require('child_process').execFile('sudo',
['-n', '5dive', 'agent', 'restart', name],
['-n', '5dive', 'agent', '_self_restart'],
{ timeout: 10_000 },
() => resolve(),
)
Expand Down
Loading