Skip to content

Rex: a hidden panel stops refreshing until it is shown - #339

Merged
yourconscience merged 2 commits into
mainfrom
fix/dash-hidden
Nov 27, 2026
Merged

yourconscience merged 2 commits into
mainfrom
fix/dash-hidden

Conversation

@yourconscience

@yourconscience yourconscience commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

What and why

tackroom rex hides 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_SESSION and REX_BLOCK it sets in every pane, whether its pane is minimized when a timed refresh comes due, and skips it if so. tackroom rex presses r in 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 (still updated 18:15, where the 30-second refresh would have moved it to 18:16), showed it (refreshing… one second later, updated 18:16 four seconds after), and left it visible 40 seconds (updated 18:17, the timer runs again). --dry-run prints the set_layer_state and the send-key it would run. golangci-lint v2.15.0 reports 0 issues and tools/sitedocs builds.

  • go test ./... and go vet ./... pass
  • I can explain this change without an AI tool

Summary by Sourcery

Prevent hidden Rex panels from refreshing in the background while ensuring they update immediately when shown.

New Features:

  • Add F5 support to refresh the dash without clearing its pending question or last result.

Bug Fixes:

  • Prevent hidden Rex panels from performing timed refreshes and unnecessary SSH host probes, then refresh immediately when shown again.

Documentation:

  • Document hidden Rex panel refresh behavior and the new F5 shortcut.

@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Add timed-refresh visibility checks for minimized Rex panes, share the manual refresh logic, and handle F5 without clearing the dash’s question or result.

  • internal/app/dash.go L296-348, L365-380, L504-508 (+5 small edits)

When showing an existing minimized panel, send F5 to refresh it and report if the key could not be sent.

  • internal/app/rex.go L201-207 (+4 small edits)

Documentation

Document that minimized Rex panels skip timed refreshes, refresh when shown again, and use F5 to preserve a pending question or result.

  • docs/terminals.md L46, L53, L241
  • docs/upgrading.md L5-10
  • rex/RECIPE.md L15, L29-33

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c87c7e7d-caba-48d5-913b-083b02f31f7c
Commits

Reviewing files that changed from the base of the PR and between a89b4e2 and 407aee0.

Files selected for processing: 5

  • docs/terminals.md
  • docs/upgrading.md
  • internal/app/dash.go
  • internal/app/rex.go
  • rex/RECIPE.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@sourcery-ai sourcery-ai 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.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread internal/app/dash.go Resolved
Comment thread internal/app/rex.go Resolved
Comment thread internal/app/rex.go Resolved
Comment thread internal/app/dash.go Resolved
…eck has a deadline and finds rex in REX_BIN_DIR

@sourcery-ai sourcery-ai 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.

Sourcery assessment

Approved.

@yourconscience
yourconscience merged commit aa5c52e into main Nov 27, 2026
11 checks passed
@yourconscience yourconscience mentioned this pull request Nov 27, 2026
2 tasks done
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