Skip to content

feat(herdr-core): warn when a PC stops programs at logout, and date agent states from the core - #5158

Closed
devswha wants to merge 4 commits into
mainfrom
feat/hc-logout-status-ms
Closed

devswha wants to merge 4 commits into
mainfrom
feat/hc-logout-status-ms

Conversation

@devswha

@devswha devswha commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

What

Two facts herdr-core now reports, shown where Ovis already shows PCs and agent ages. No new rows, buttons or blocks.

  1. Programs stop at logout (hc 0.1.21+). hc reports keeps_running_after_logout and logout_linger_user in hello, server.status and machine.list. When a core says keeps_running_after_logout: false (systemd ends the user's programs when the account's last login ends), the PC's name gets a small warning mark where it is already shown (the sidebar's PC header, or with a single PC the desktop status bar and the phone top bar); its tooltip, and the existing PC menu's description, give the one command that fixes it (sudo loginctl enable-linger -- <user>). Older cores leave the fields out and nothing shows.
  2. Agent state ages from the core (hc 0.1.23; for another machine only when this PC's hc is 0.1.23+ too). Status events and terminal records carry status_ms, the time the agent's status last changed, also for other machines. The agent list and the inbox already show "since when"; they now prefer the core's time when it describes the same state Ovis shows, so the age survives an Ovis server restart. Otherwise (older cores, states Ovis infers itself, background waits) the existing stamp stays.

Contract changes are additive: optional logout_warning on SessionSnapshot and Machine, optional core_status_time on HerdrPane and the pane-status frame.

UI change: waits for the maintainer's look (before/after screenshots from the demo, desktop 1280 and phone 390, light theme, are with the lead).

Checks

  • New regression tests fail on main (4) and pass here; focused tests 830 pass, typecheck clean.
  • Live against isolated hc 0.1.18 and 0.1.23: 3 pass each.
  • Demo: desktop keyboard menu, phone press-and-hold, warning gone when the core no longer reports it.
  • Not run: a real logout, Windows and macOS.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d964d49 and 51d3d08.

Files selected for processing: 24

  • DESIGN.md
  • server/herdr-core/adapter.test.ts
  • server/herdr-core/adapter.ts
  • server/herdr-core/connection.ts
  • server/herdr-core/layout-ops.ts
  • server/herdr-core/machine-bridge.ts
  • server/herdr-core/machine-scope.ts
  • server/herdr-core/snapshot.ts
  • shared/logout-warning.ts
  • src/App.tsx
  • src/components/AgentSidebar.test.tsx
  • src/components/AgentSidebar.tsx
  • src/components/HeaderPcSwitch.test.tsx
  • src/components/HeaderPcSwitch.tsx
  • src/components/MachineHeader.tsx
  • src/components/MachineLogoutMark.css
  • src/components/MachineLogoutMark.tsx
  • src/components/MachineSidebar.tsx
  • src/components/StatusBar.css
  • src/components/StatusBar.test.tsx
  • src/components/StatusBar.tsx
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • PCs that stop programs at logout now display a warning with instructions for keeping programs running.
  • Improvements
    • Agent status ages now use timing reported by the PC when available, including after the app restarts. When reported timing isn’t available or doesn’t match the current status, the existing timing behavior is retained.

The change adds core-reported logout warnings to machine data and the interface. It also carries core-reported status timestamps through snapshots and live updates, then uses matching timestamps to display agent-state ages.

Changes: Core-reported status times

Layer / File(s) Summary
Derive and retain core status times
shared/protocol.ts, server/herdr-core/{snapshot,core-model,machine-scope}.ts
Pane and status-message types gain optional core status times. Herdr-core derives timestamps from status reports, stores them for terminals, and applies version checks when reading terminal data.
Propagate timestamps through status updates
server/collector.ts, server/core/status.ts, server/herdr-core/adapter.ts, server/machines.ts, src/lib/{snapshot,useMachineRoster}.ts, server/herdr-core/adapter.test.ts
Live events and snapshot replay pass timestamps into pane-status updates. Updates retain an existing timestamp only when the pane status is unchanged. Tests check timestamp support across core versions.
Use reported times for agent ages
src/lib/agentStateSince.ts, src/components/{AgentSidebar,InboxList}.tsx, src/components/AgentSidebar.test.tsx, changelog.d/core-logout-status-time.md
AgentSidebar and InboxList prefer a matching core-reported timestamp and retain their existing fallbacks. The sidebar test checks matching and mismatched states.

Core-reported logout warnings

Layer / File(s) Summary
Read and represent logout warnings
shared/{protocol,machines}.ts, server/herdr-core/{logout-protection,connection,machine-bridge,layout-ops}.ts
Core logout settings produce an optional warning for supported machines. Local cores can use server.status with a hello-response fallback. Snapshot and machine types carry the warning.
Sync and display logout warnings
server/machines.ts, server/{hc-machines.test.ts,herdr-core/adapter.test.ts}, src/components/{MachineHeader,MachineSidebar}.tsx, src/components/Machines.css, src/lib/i18n.{ja,ko,zh}.ts, DESIGN.md
Machine roster sync adds or clears warning data. The machine header displays a warning icon and translated command; menu state text includes the warning. Tests cover warning updates and source settings.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Merge Risk: Low · previous review d964d

This adds a logout-linger warning on PC names and uses core-reported times for agent state ages. The remaining known gap is that a PC whose clock differs from the browser's can show an agent's state age a little too small or too large. This is cosmetic and does not affect data, so the change is mergeable with that awareness.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: a warning when a PC stops programs at logout, and dating agent states from the core. Both appear in the changeset (logout-protection, machine roster warning, repo…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description covers the What (two core-reported facts: logout warning for hc 0.1.21+ and agent-state timestamps for hc 0.1.23), the contract additions, and a Validation section listing tests, live …
Full details: Title check

Explanation

The title names the two main changes: a warning when a PC stops programs at logout, and dating agent states from the core. Both appear in the changeset (logout-protection, machine roster warning, reportedSince, core_status_time). The title is specific and matches the objectives. It is a long single sentence, but it is accurate.

Full details: Description check

Explanation

The description covers the What (two core-reported facts: logout warning for hc 0.1.21+ and agent-state timestamps for hc 0.1.23), the contract additions, and a Validation section listing tests, live checks, demo checks, and what was not run. It does not link an issue for the feature, which the template asks for, and it does not name the exact commands run (for example bun run check fast or full), so the Validation section is only partly in template form. The core content is complete enough to pass.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0321c9e and d964d49.

Files selected for processing: 29

  • DESIGN.md
  • changelog.d/core-logout-status-time.md
  • server/collector.ts
  • server/core/status.ts
  • server/hc-machines.test.ts
  • server/herdr-core/adapter.test.ts
  • server/herdr-core/adapter.ts
  • server/herdr-core/connection.ts
  • server/herdr-core/core-model.ts
  • server/herdr-core/layout-ops.ts
  • server/herdr-core/logout-protection.ts
  • server/herdr-core/machine-bridge.ts
  • server/herdr-core/machine-scope.ts
  • server/herdr-core/snapshot.ts
  • server/machines.ts
  • shared/machines.ts
  • shared/protocol.ts
  • src/components/AgentSidebar.test.tsx
  • src/components/AgentSidebar.tsx
  • src/components/InboxList.tsx
  • src/components/MachineHeader.tsx
  • src/components/MachineSidebar.tsx
  • src/components/Machines.css
  • src/lib/agentStateSince.ts
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts
  • src/lib/snapshot.ts
  • src/lib/useMachineRoster.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.

@devswha

devswha commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

Review round (omo + Codex):

  • omo MEDIUM (a remote status_ms trusted when only the remote core is 0.1.23, while an older relaying hc keeps the first timestamp): fixed in 2b3217b, both the relaying and the remote core must be 0.1.23+; the local rule is the same for snapshots and live events.
  • Codex MEDIUMs, all reproduced and fixed in a0b7dc2: a lone PC showed no warning (its PC header is hidden) - the mark now sits beside the PC name that is already shown (desktop status bar, phone top bar), no new rows; core-reported ages froze on first load - the clock now runs for either source; an Antigravity plan review inherited an older permission prompt's time - those reports keep Ovis's own timer.
  • Codex LOWs fixed: a failed status refresh no longer brings back a cleared warning; the wording says the programs stop when the account's last login ends (en/ja/ko/zh).
  • Left as LOW: status_ms is the source PC's clock, compared with the viewer's (no skew correction); one extra server.status per snapshot read on 0.1.21+ cores.
    Screenshots (single PC, before/after, desktop 1280 and phone 390, light) are with the lead for the maintainer's look.

@devswha

devswha commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha

devswha commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit reviewed the first head (no actionable comments) and is rate limited for the later commits: it did not review head 51d3d08. That head passed check fast in the CI runner image (28400 pass, 0 fail) and every CI check; the review round's findings are listed above.

@devswha

devswha commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

Merged into #5153 (same area, one PR for the 0.5.14 beta). Its commits, review notes and screenshots carry over there.

@devswha devswha closed this Dec 1, 2026
devswha added a commit that referenced this pull request Dec 1, 2026
…logout, and date agent states from the core (#5153)

Bundles herdr-core 0.1.23 in the desktop app and the Settings installer,
and adopts two facts 0.1.23 reports. #5158 is merged into this branch
(same area, one PR for the 0.5.14 beta).

## 1. herdr-core 0.1.23 (was 0.1.17)

- `app/electron/scripts/runtimes.ts`, `server/herdr-core/install.ts`:
version and SHA-256 per target, from
`releases.herdr.dev/core/0.1.23/manifest.json`.
- CI's herdr-core live contract runs 0.1.23 too (0.1.17 and 0.1.18 stay;
nothing removed).
- `scripts/hc-schema.json` and `server/herdr-core/hc-api.generated.ts`
regenerated from 0.1.23's `hc schema`, run against an isolated core (`hc
schema` answers for the session's running core).
- The fake core follows 0.1.23's stop: it sends the terminal's
`finished` event and the attach CLOSE apart, in either order (0.1.18
always closes first). The live stop test compares them unordered and
still requires both before the line ends; it failed 7 of 30 runs on
0.1.23 before, 30/30 after.
- Docs, THIRD_PARTY_NOTICES and a changelog fragment name 0.1.23.

### macOS packaging: the standalone `herdr-core`, not `Herdr Core.app`

Since 0.1.18 hc's macOS archive holds both `Herdr Core.app` and a
standalone `herdr-core`. The app keeps shipping the standalone one:
1. Nothing new for the user to see: no second app, and the core stays
where it is (the app's data folder), not hc's shared
`~/.local/share/herdr-core`, which `hc update --from <.app>` would also
switch for a user's own `hc`.
2. Signing and notarization stay as they are: the build re-signs
`ovis/bin/herdr-core` with the app's identity, while `Herdr Core.app`
must keep Herdr's own signature (hc refuses another team's) and would
need a `signIgnore` carve-out.
3. App updates work as today: `installCore` runs `hc update --from
<bundled herdr-core>`, which hc keeps supporting for non-bundled
installs, and the running core moves to 0.1.23 with its terminals kept.

Trade-off: programs in Ovis's terminals do not get Herdr Core's own
macOS privacy identity (same as today). Linux ships the same single
`herdr-core`; Windows the same `herdr-core.exe` with `conpty\` beside
it.

## 2. Programs stop at logout (hc 0.1.21+)

hc reports `keeps_running_after_logout` and `logout_linger_user` in
`hello`, `server.status` and `machine.list`. When a core says
`keeps_running_after_logout: false` (systemd ends the user's programs
when the account's last login ends), the PC's name gets a small warning
mark where it is already shown (the sidebar's PC header, or with a
single PC the desktop status bar and the phone top bar); its tooltip,
and the PC menu's description, give the command that fixes it (`sudo
loginctl enable-linger -- <user>`). No new rows, buttons or blocks.
Older cores leave the fields out and nothing shows; a failed refresh
keeps the last answer.

## 3. Agent state ages from the core (hc 0.1.23)

Status events and terminal records carry `status_ms`, the time the
agent's status last changed. The agent list and the inbox already show
"since when"; they now prefer the core's time when it describes the same
state Ovis shows, so the age survives an Ovis server restart. For
another machine only when both this PC's hc and that machine's are
0.1.23+ (an older relaying hc keeps the first timestamp). States Ovis
infers itself (background waits, Antigravity's plan review) keep Ovis's
own timer.

Contract changes are additive: optional `logout_warning` on
`SessionSnapshot` and `Machine`, optional `core_status_time` on
`HerdrPane` and the `pane-status` frame.

## Checks

- Linux, isolated core: `installCore` with a running 0.1.17 core and a
live terminal, then with 0.1.23: `restarted: true`, same core id,
0.1.23, the terminal still live.
- macOS (eamac, fresh clone, Developer ID signed build, not notarized:
no notary key there): the app's `ovis/bin/herdr-core` says `hc 0.1.23`
and is signed by the app's team; `codesign --verify --deep --strict`
passes; no `.app` inside Resources. The same 0.1.17 -> 0.1.23 update
keeps the terminal, writes no `bundle-upgrade-notice` and makes no
`~/.local/share/herdr-core`.
- Windows (winvm, desktop session): checksums match; the app's install
layout with 0.1.17, then `update --from` 0.1.23: same core id, terminal
kept, `conpty\` kept, a new PowerShell terminal answers.
- Regression tests that fail on main: the stop order (both versions),
the logout warning and status-time gating (local hc 0.1.22 + remote
0.1.23, single-PC layouts, first-load clock, Antigravity plan review).
- Review round: omo + Codex on both parts; their MEDIUMs are fixed
(details in the comments here and on #5158).
- UI: before/after screenshots (desktop 1280, phone 390, several PCs and
one PC) are with the lead.

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant