Skip to content

fix: scope agent views to the selected machine - #3784

Open
akbash-bot wants to merge 2 commits into
herdrdev:masterfrom
akbash-bot:akbash/3732-machine-scoped-agent-view
Open

fix: scope agent views to the selected machine#3784
akbash-bot wants to merge 2 commits into
herdrdev:masterfrom
akbash-bot:akbash/3732-machine-scoped-agent-view

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Issue

A current-workspace agent view shows agents from saved machines whose server-local workspace ID matches the selected workspace.

Problem

Each server evaluated current_workspace_id before the client combined their rows. w1 on Local and w1 on Remote therefore both matched.

How did we fix it?

Herdr now applies the selected machine's validated view to the combined agent facts. Current workspace and tab matches include endpoint identity, while independent clauses such as blocked status still work across machines. Servers send this policy through an optional revision-bound endpoint control, so generation-1 snapshots and older clients remain compatible.

Verification

The regression test failed before because Local/w1 and Remote/w1 both rendered. It now shows only the selected side and switches correctly. Compound filters, defaults, custom sorting, stale controls, malformed controls, old-server fallback, and set/replace/clear pass. Lint, Windows lint, docs, maintenance, integration, marketplace, and scaling checks pass. Full nextest passed 3,282 tests; three unrelated root/live-handoff environment tests still fail locally.

refs #3732

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b2fc0744-9700-4b99-8627-70cd9a725a4f

📥 Commits

Reviewing files that changed from the base of the PR and between a112e09 and f222592.

📒 Files selected for processing (3)
  • src/client/shell/endpoint_navigation.rs
  • src/client/shell/endpoints.rs
  • src/client/shell/tests/endpoints.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change centralizes agent view filtering and sorting. It adds a revision-bound endpoint projection protocol. Servers send view changes with snapshots. Clients validate and store projections against endpoint generations and revisions. Aggregate rendering and navigation apply the active endpoint view. Tests cover filtering, sorting, stale projections, capability handling, and projection lifecycle.

Suggested reviewers: ogulcancelik

Priority: ⬇️ Low — Defer the machine-scoped agent view change because it is a compatibility and rendering update spanning endpoint projection, server state, and client navigation.

Merge Risk: ⚪ Minimal · up to f2225

Agent views now scope workspace and tab matches to the selected machine while preserving independent cross-machine filters. Revision-bound projection handling and fallback behavior are covered, with no concrete merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.07% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 108 functions across 19 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: scoping agent views to the selected machine.
Description check ✅ Passed The description directly explains the cross-machine scoping problem, the endpoint projection fix, compatibility behavior, and verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

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

Comment @coderabbitai help to get the list of available commands.

@kangal-bot

Copy link
Copy Markdown
Collaborator

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

@kangal-bot I will review pull request #3784.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR applies the selected machine’s validated agent-view policy to the combined agent list while preserving endpoint identity for contextual workspace and tab comparisons.

  • Adds a shared agent-view evaluator used by server-local and aggregated client views.
  • Introduces revision- and generation-bound endpoint controls for transporting agent-view policies compatibly.
  • Aligns federated tab and pane sorting with stable public numbers.
  • Adds endpoint-scoped worktree collapsing and inactive-machine arrow controls.
  • Expands regression coverage for cross-machine filtering, sorting, stale controls, navigation, rendering, and preference persistence.

Confidence Score: 5/5

The PR appears safe to merge; no actionable new defects or outstanding previous findings remain.

The selected endpoint’s policy is coherently paired with its snapshot, contextual IDs carry endpoint scope, fallback behavior remains compatible, and stable public ordering resolves the previously reported sorting discrepancy.

Important Files Changed

Filename Overview
src/agent_view_eval.rs Centralizes filter and sorting evaluation, including endpoint-scoped identifiers for contextual comparisons.
src/client/shell/aggregate_navigation.rs Applies the selected endpoint’s validated view to combined agent rows and uses stable public tab and pane numbers.
src/client/shell/endpoints.rs Tracks capability-negotiated, generation- and revision-bound agent-view projections alongside endpoint snapshots.
src/protocol/endpoint.rs Defines the optional agent-view projection capability, control envelope, and encoding support.
src/server/headless/render.rs Sends coherent snapshot and agent-view projection updates to compatible endpoint clients.
src/client/shell/endpoint_sidebar.rs Renders endpoint-scoped grouped workspaces and dedicated machine-collapse hit targets.
src/client/shell/state.rs Maintains separate local and per-SSH-endpoint worktree-collapse state.
src/client/shell/tests/endpoints.rs Covers cross-machine view scoping, stable ordering, control freshness, endpoint collapsing, and grouped-workspace interactions.

Sequence Diagram

sequenceDiagram
    participant S as Selected server
    participant C as Saved-machine client
    participant O as Other servers
    S->>C: Agent-view projection (boot ID + revision)
    S->>C: Matching shell snapshot
    O->>C: Other endpoint snapshots
    C->>C: Validate and pair projection with snapshot
    C->>C: Combine agent facts from all endpoints
    C->>C: Evaluate selected view with endpoint-scoped context
    C->>C: Render and navigate filtered, sorted agents
Loading

Reviews (3): Last reviewed commit: "fix: preserve stable agent view ordering" | Re-trigger Greptile

Comment thread src/client/shell/aggregate_navigation.rs Outdated
@akbash-bot
akbash-bot force-pushed the akbash/3732-machine-scoped-agent-view branch from 55a0d6a to a112e09 Compare September 8, 2026 14:41
@akbash-bot

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

@akbash-bot I will review pull request #3784.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@akbash-bot
akbash-bot force-pushed the akbash/3732-machine-scoped-agent-view branch from a112e09 to f222592 Compare September 8, 2026 15:01
@akbash-bot

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

@akbash-bot I will review pull request #3784.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

2 participants