Repository navigation
Rex: a hidden panel stops refreshing until it is shown - #339
Conversation
Reviewer's GuideImplementationAdd timed-refresh visibility checks for minimized Rex panes, share the manual refresh logic, and handle F5 without clearing the dash’s question or result.
When showing an existing minimized panel, send F5 to refresh it and report if the key could not be sent.
DocumentationDocument that minimized Rex panels skip timed refreshes, refresh when shown again, and use F5 to preserve a pending question or result.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedYou'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 46 minutes. View limit details
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. |
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="internal/app/dash.go" line_range="312" />
<code_context>
+ if err != nil {
+ return false
+ }
+ out, err := exec.Command(rex, "api", "call", "-s", session, "session.view").Output()
+ if err != nil {
+ return false
</code_context>
<issue_to_address>
**Automatic refreshes stop after a hang**
When the Rex CLI or `session.view` hangs during a timed visibility check, `exec.Command(...).Output()` waits without a deadline, so the call never returns a `dashTickMsg`; `Update` cannot schedule the next tick, and automatic refreshes stop.
Run `session.view` with a deadline and ensure a timeout still allows `Update` to schedule the next tick.
</issue_to_address>
### Comment 2
<location path="internal/app/rex.go" line_range="202" />
<code_context>
return err
}
+ // A hidden dash skipped its timed refreshes; r refreshes it now.
+ if _, err := run(true, "send-key", "-s", session, "-b", panelBlock, "r"); err != nil {
+ return err
+ }
</code_context>
<issue_to_address>
**Showing the panel cancels a pending action**
When a confirmation is pending while the panel is hidden and the panel is shown again, `runRexCommand` sends `r`, but `dashModel.key` handles `m.pending` before the refresh case and treats every key except `y` as cancellation; the question is canceled and the panel does not refresh.
Refresh the panel without sending a key that `dashModel.key` can interpret as a confirmation response.
</issue_to_address>
### Comment 3
<location path="internal/app/rex.go" line_range="202" />
<code_context>
return err
}
+ // A hidden dash skipped its timed refreshes; r refreshes it now.
+ if _, err := run(true, "send-key", "-s", session, "-b", panelBlock, "r"); err != nil {
+ return err
+ }
</code_context>
<issue_to_address>
**Panel reappears with stale data**
When rex accepts `session.set_layer_state` but the following `send-key` fails, `runRexCommand` returns an error without refreshing the dash after restoring the layer, leaving the panel visible with stale data until a later refresh.
Refresh the dash through a fallback or retry before returning the `send-key` error.
</issue_to_address>
### Comment 4
<location path="internal/app/dash.go" line_range="308" />
<code_context>
+ if session == "" || block == "" {
+ return false
+ }
+ rex, err := exec.LookPath("rex")
+ if err != nil {
+ return false
</code_context>
<issue_to_address>
**Hidden panel still launches host probes**
When the Rex panel's server `PATH` omits the Rex CLI, `exec.LookPath("rex")` fails, so `dashHiddenInRex` returns false and timed refreshes still launch host probes while the panel is minimized.
Detect the hidden panel without relying on the Rex CLI being discoverable in the server `PATH`.
</issue_to_address>Sourcery assessment
Approval pending. 4 findings to address first.
Blocking findings: internal/app/dash.go:312, internal/app/rex.go:202, internal/app/rex.go:202, internal/app/dash.go:308
…eck has a deadline and finds rex in REX_BIN_DIR
What and why
tackroom rexhides its panel by minimizing it, and the dash inside kept its timers: the sync state every 30 seconds, and every 5 minutes an SSH probe of each host for the crons and another for the machines. A panel left hidden in several Rex sessions meant that many copies probing the hosts in the background.Now the dash asks Rex, through the
REX_SESSIONandREX_BLOCKit sets in every pane, whether its pane is minimized when a timed refresh comes due, and skips it if so.tackroom rexpressesrin the panel when it shows it again, so it refreshes at once. Outside Rex, or when Rex cannot answer, the dash refreshes as before.How I checked it
In a scratch Rex session with the dev build: opened the panel (header
updated 18:15), hid it, waited 100 seconds (stillupdated 18:15, where the 30-second refresh would have moved it to 18:16), showed it (refreshing…one second later,updated 18:16four seconds after), and left it visible 40 seconds (updated 18:17, the timer runs again).--dry-runprints theset_layer_stateand thesend-keyit would run. golangci-lint v2.15.0 reports 0 issues andtools/sitedocsbuilds.go test ./...andgo vet ./...passSummary by Sourcery
Prevent hidden Rex panels from refreshing in the background while ensuring they update immediately when shown.
New Features:
Bug Fixes:
Documentation: