fix: preserve truthful process and session state - #1391
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review. 📝 WalkthroughWalkthroughDesktop session states now include ChangesDesktop session state handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR corrects process and session-state reporting for permission-limited monitors, with focused tests and standard checks passing; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant listDesktopSessionsCallback
participant processManager
participant isSessionBusyWithCli
listDesktopSessionsCallback->>processManager: Check managed tab process
processManager-->>listDesktopSessionsCallback: Return process state
listDesktopSessionsCallback->>isSessionBusyWithCli: Check CLI activity
isSessionBusyWithCli-->>listDesktopSessionsCallback: Return activity state
listDesktopSessionsCallback-->>listDesktopSessionsCallback: Emit idle, busy, or unknown state
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThe PR makes process probes distinguish permission failures from missing processes and reconciles persisted tab state with live process evidence.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified. The changed process probes preserve live state on permission failures, cleanup remains limited to confirmed missing processes, and all in-repository consumers handle the expanded session-state contract consistently. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Persisted tab state] --> D[Session-state reconciliation]
B[Managed process entry] --> D
C[CLI activity and PID probe] --> D
C --> E{Probe result}
E -->|alive or EPERM| F[CLI activity is busy]
E -->|ESRCH| G[Remove stale activity]
E -->|other error| H[Preserve activity without claiming busy]
F --> D
D -->|persisted busy or live evidence| I[busy]
D -->|persisted idle and no live evidence| J[idle]
D -->|no conclusive evidence| K[unknown]
I --> L[desktop_sessions_list]
J --> L
K --> L
L --> M[maestro-cli session list]
Reviews (1): Last reviewed commit: "fix: preserve truthful process and sessi..." | Re-trigger Greptile |
|
Thanks for this, @heinbrian - genuinely good catch. Conflating I verified locally against
Two small things I would like addressed before merge, plus one note. 1.
|
What changed
EPERMfromprocess.kill(pid, 0)as proof that the process existsESRCHunknownsession state in the CLI instead of coercing it toidleWhy
Read-only and sandboxed monitors can receive
EPERMwhile probing a liveMaestro process. The existing catch-all behavior reported stale discovery,
removed valid CLI activity, and exposed working tabs as idle. That made health
and recovery decisions depend on a permission failure rather than live state.
Impact
Process-restricted monitors no longer turn
EPERMinto a false crash. Sessionlist output reports busy when a matching managed process or active CLI job is
present, and preserves uncertainty when neither persisted nor live evidence is
conclusive.
Validation
tsc -p tsconfig.main.json --noEmittsc -p tsconfig.cli.json --noEmitThis PR changes source and tests only. It does not modify an installed Maestro
application or request a release.
Summary by CodeRabbit
New Features
unknownstate instead of incorrectly showing it as idle.Bug Fixes
Tests