Skip to content

feat(place/remote_debug): get logs, status and screen captures from PlaceOS apps - #653

Open
MrYuion wants to merge 3 commits into
masterfrom
feat/remote-debug
Open

MrYuion wants to merge 3 commits into
masterfrom
feat/remote-debug

Conversation

@MrYuion

@MrYuion MrYuion commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PlaceOS/user-interfaces#753 lets apps such as Booking Panel, Control and Signage send their logs, status and screen captures to a RemoteDebug driver, but that driver did not exist. This PR adds it.

It has the same methods and bindings as the mock in libs/mocks/src/lib/realtime/remote-debug.ts. It also follows the "Driver requirements" in docs/remote-debug.md of that PR.

  • For the people who debug: request_logs, set_level, stop_logs and send_command. These need the support role.
  • For the devices: post_logs, command_result and register. Fixed devices, such as panels and signage, call register each 15 minutes so the admin views list them.
  • Bindings: device:<id>, devices, logs:<id> and results:<id>. Screen captures are results, with the upload ID in result.data.upload_id.
  • Device ID owner: the first user that calls for a device ID owns it. The driver ignores device calls for that ID from other users until it removes the device. It keeps the owner while the device has a request or commands.
  • Limits: 8,000 entries per device (all the entries that a device keeps, so before can get them all), 50 results per device, 1,000 devices and 20 commands per device. send_command returns null when the list is full. Commands time out after 15 minutes. A log request stops when its duration ends.
  • Time limit: the driver removes each entry and result 7 days after it gets them, also for a device that still registers. It removes a device that does not call for 7 days.

Differences from the mock

  • A command that is not valid raises an error. The mock returns null, which the admin panel shows as "list full".
  • A device:<id> binding with no request and no commands is set to null, so PlaceOS removes the key.
  • post_logs and command_result are ignored when device.id is not the device_id argument. post_logs also ignores a late batch from an app session before a reload.
  • devices updates at once when a device is added, changed or removed. When only last_seen changes, it updates once each minute. Without this, each post_logs and register call would send the full device list again.
  • Input limits: device IDs match [A-Za-z0-9_-]{1,64}, 500 characters for each device text field, 100 entries for each call, 2,000 characters for each message, 100,000 characters for each result, 50 settings keys of 200 characters, and navigate paths of 2,000 characters.
  • Status writes go to Redis and let other calls run. So the driver checks the request and the owner again after a write, and each log request timer has a token, so an old timer cannot end a newer request.

Known limits

  • The driver cannot limit who reads its bindings. The devices need access to the system, so they can also read devices, logs:<id> and results:<id>.
  • When a status write fails after the Redis client reconnects, the driver does not try it again. Expired data or a finished command can then stay in a binding until the next write of that key.

Not in this PR

  • Removal of old capture uploads. The doc suggests a sweep, after a time limit, of uploads named remote-debug-<device>-<command>. That also gets uploads from commands that timed out, and does not trust an upload ID from a device.
  • Each post_logs call sends logs:<id> again with up to 8,000 entries, about 2.3 MB. Three devices that send each second write about 20 MB/s. The mock works the same way. A log request lasts 1 hour maximum.
  • The framework writes each status value to the debug log. A change in placeos-driver can log only the key for large values.
  • A device clock that moves back before a reload makes the new session look older, so the driver ignores its logs until the old entries expire.

Tests

./harness report drivers/place/remote_debug.cr: 7 examples pass. They cover the same cases as the mock tests, plus the result size limit, register, the full command list, device ID owners, older entries with before, and late batches from an earlier session. The 7-day limit and the 15-minute command timeout have no test, as the driver has no test clock.

Council review

Rounds: 4 with gpt-6.2-sol on high. Verdict: approved. Two disputed items were left for the author: a test of the 7-day limit, and a retry of status writes that fail after the Redis reconnect (see Known limits).

Aspect Round 1 Round 2 Round 3 Round 4
Correctness 8/10 7/10 7/10 9/10
Simplicity 8/10 9/10 — —
Readability 8/10 9/10 — —
Coverage 6/10 8/10 8/10 —
Security 6/10 8/10 9/10 —
Privacy 6/10 7/10 7/10 —
Concurrency 6/10 7/10 7/10 9/10
Data integrity 6/10 7/10 7/10 9/10
Performance 7/10 8/10 — —
Memory 6/10 7/10 7/10 9/10

Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

…laceOS apps

Adds the RemoteDebug logic driver for the remote debugging interface in
PlaceOS/user-interfaces#753. People with the support role request logs and
send commands by device ID. Devices send entries with `post_logs` and
results with `command_result`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MrYuion
MrYuion requested review from stakach and w-le November 19, 2026 11:21
MrYuion and others added 2 commits November 19, 2026 22:51
- add `register` so fixed devices show in `devices`
- remove `media:<id>`; captures stay in `results:<id>`
- remove devices that do not call for 7 days, with their data
- write `last_seen`-only changes to `devices` each minute
- return nil from `send_command` when the device has 20 commands
- remove the StaffAPI upload removal, which trusted the upload ID from the device

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- keep 8,000 entries per device, so `before` gets all device entries
- keep the first user that calls for each device ID, and ignore device
  calls for that ID from other users
- remove each entry and result 7 days after the driver gets it
- give each expiry timer a token, so an old timer cannot end a newer request
- check the request and owner again after writes that let other calls run
- ignore late batches from an app session before a reload
- limit device text fields, settings keys and navigate paths
- cancel command timeouts when the result arrives

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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