fix: clear own display elements at agent startup - #4
Conversation
After the v1.1 upgrade, the first draw of the new agent got HTTP 400 because the display still held the previous process's element with the same id but a different element type; the firmware rejects in-place type changes. Clearing the app's own elements at startup prevents any such collision after upgrades. Applied to both integrations/calendar_countdown/main.py and integrations/ci_status/main.py: add client.clear(APP) immediately after BusyBarClient construction and before the poll loop.
5177d71 to
9280161
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5177d71e18
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1 @@ | |||
| /Users/josumi/.venvs/busybar-integrations No newline at end of file | |||
There was a problem hiding this comment.
Remove the machine-specific
.venv symlink
On every checkout where /Users/josumi/.venvs/busybar-integrations does not exist—including the Ubuntu test job in .github/workflows/ci.yml:13-16—this becomes a dangling .venv entry. The workflow's uv sync --group dev then exits with failed to create directory .../.venv: File exists, so CI and the documented uv run setup commands cannot run until the symlink is manually removed.
Useful? React with 👍 / 👎.
|
|
||
| cfg = load_config() | ||
| client = BusyBarClient(host=cfg["device"]["host"]) | ||
| client.clear(APP) # drop any stale elements from a previous process (type collisions 400) |
There was a problem hiding this comment.
Guard the startup clear in dry-run mode
When a user runs the documented --once --dry-run command against a reachable device, this unconditional call still sends a DELETE and removes the integration's currently displayed elements, contradicting the dry-run guarantee that the device is untouched. The equivalent startup clear in integrations/ci_status/main.py has the same problem, so both calls should be skipped when args.dry_run is set.
Useful? React with 👍 / 👎.
After the v1.1 upgrade, the new agent's first draw got HTTP 400: the display still held the previous process's element with the same id but a different type, and the firmware rejects in-place type changes. Clearing the app's own elements once at startup makes agent upgrades collision-proof. (The element-timeout design already self-healed this in 90 s; this removes the window entirely.)
🤖 Generated with Claude Code