Skip to content

fix: do not treat unknown presence as machine offline - #486

Open
slashdevcorpse wants to merge 4 commits into
LodyAI:mainfrom
slashdevcorpse:fix/presence-unknown-not-offline
Open

fix: do not treat unknown presence as machine offline#486
slashdevcorpse wants to merge 4 commits into
LodyAI:mainfrom
slashdevcorpse:fix/presence-unknown-not-offline

Conversation

@slashdevcorpse

@slashdevcorpse slashdevcorpse commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #484

Problem / pressure

getOnlineMachineIds() returning null means the presence room did not join. MCP and chat landing treated that as every remote machine offline, including a live PC.

Summary

MCP makeMachineOnlineLookupForMcp and create-options treat null as unknown (usable). Chat landing treats the local probe machine as online, and only claims Offline when presence is synced and there is no heartbeat. Does not sweep other .has() surfaces.

Before / after

Before After
Presence not joined → MACHINE_OFFLINE and hidden machines. Unknown is not offline.
Chat landing has() → Offline while syncing. Offline only when presence is synced and the heartbeat is missing.

Test plan

  • corepack pnpm exec vitest run src/mcp/lody-mcp-server.test.ts -t "MACHINE_OFFLINE|shares one remote Machine presence" — 2 passed.
  • No chat-landing unit for the callback. No live desktop run.

Context handoff

Instructions for reviewing agents

  • Review focus: makeMachineOnlineLookupForMcp in lody-mcp-server.ts and isPresenceMachineOnline in chat-landing.tsx.
  • Decisions to challenge: Unknown treated as usable/online rather than a third UI state. Other .has() surfaces (sidebar, settings) are unchanged.
  • Plausible failures / evidence gaps: A truly offline remote machine can be listed while presence is joining. Chat landing has no new unit test.

Authoring context

  • User goal / directives: Open the remaining false-offline hole as an issue and a small real fix PR.
  • Constraints / non-goals: Do not retouch [Bug] Bounded renderer reconnect still paints the PC offline #480/fix(components): keep presence snapshots across bounded reconnect stop #481 snapshot wipe. Do not convert every UI caller to three-state. Do not change Flock sync.
  • Risk-bearing decisions: Unknown presence allows create/list of remote machines until RPC fails later.
  • Destructive or irreversible behavior: None.
  • Deliberately not done or tested: Sidebar/settings/CLI machine list. Live presence-join failure.
  • Unknowns / confidence: High on the MCP null path. Medium on chat-landing coverage without a component test.

getOnlineMachineIds() null means the presence room did not join. MCP and chat landing no longer map that to MACHINE_OFFLINE.
Also treat the local probe machine as online on chat landing so a live PC is not labeled offline after presence has synced.
@slashdevcorpse slashdevcorpse changed the title fix(mcp): do not treat unknown presence as machine offline fix: do not treat unknown presence as machine offline Sep 8, 2026
@slashdevcorpse
slashdevcorpse marked this pull request as ready for review September 8, 2026 01:12
Copilot AI lite review requested due to automatic review settings September 8, 2026 01:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 844c3759dc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +760 to +761
onlineMachineIds.has(machineId as MachineId) ||
presenceSyncState !== 'synced',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include unknown machines in the mobile selector

When presence is not synced on Web/mobile, this callback makes hasNoMachine false and populates selectableMachines from cached machines, but mobileSheetMachineOptions is still sourced from useOnlineMachines() at chat-landing.tsx:3859, which filters strictly to heartbeat IDs in hooks/use-online-machines.ts:23-25. The mobile sheet therefore renders an enabled, non-loading Machine picker with no options, preventing users from choosing or switching to the live remote PC in the exact missing-presence-join scenario this change is intended to support.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 498e148. mobileSheetMachineOptions now maps selectableMachines (same source as the desktop picker and hasNoMachine) instead of heartbeat-only useOnlineMachines().

Unknown presence already populates selectableMachines. The mobile picker was still filtered to heartbeat IDs via useOnlineMachines.

Model: grok-4.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Presence unknown is treated as machine offline

2 participants