Skip to content

[fix] Hide empty sessions from lists; connect overview Files to the agent drive - #5944

Merged
mmabrouk merged 7 commits into
release/v0.112.0from
fix/empty-sessions-and-drive-views
Aug 12, 2026
Merged

[fix] Hide empty sessions from lists; connect overview Files to the agent drive#5944
mmabrouk merged 7 commits into
release/v0.112.0from
fix/empty-sessions-and-drive-views

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Two founder-reported bugs. First, the Sessions page, home cards, and the sidebar's session list were flooded with "Untitled session / No agent yet" rows: the backend's liveness heartbeat creates a session row on first touch even when no conversation ever lands, and bursts of SDK-shaped traffic produced dozens of them (28 of the first 30 rows in the founder's project). Second, on an agent's overview page, Files → "View All" always opened an empty folder even though the agent's files exist and show in the card.

Changes

Empty sessions. A shared list rule (isStartedSession in @agenta/sessions) shows a session only when a person could recognize it: it has a turn, a title, a message preview, or it is an automation. Pins and gated (waiting) rows are always kept. Applied at render level in the Sessions-page and card-list hooks; the reconciler and session creation are untouched. Because whole pages can consist of hidden rows, the list fetches the next page when everything it loaded was filtered. The sidebar additionally widens its single request window (20 → 100 rows) so empties cannot starve its seven recent slots, and filters by the same rule. Untitled-but-real conversations still show, by design.

Overview Files. The drive resolver only knew how to resolve paths through a session's working-directory mount, and the overview has no session, so the file browser mounted nothing and rendered an empty tree. The drive now presents the agent's own mount at the root when it is the whole drive (agentOnly mode), which also fixes the same empty browser in the playground config panel for sessions that have no working directory yet. The "N files" count chip next to the breadcrumb at root is removed (folder item counts and file sizes stay).

Before: 28 placeholder rows above two real sessions; View All shows an empty folder.
After: only real sessions listed everywhere; View All lists and opens the agent's actual files.

Tests

  • 7 new unit tests in sessionListPolicy.test.ts (hide beat-only rows, keep turn/title/preview/automation rows, order-preserving filtering, the three top-up decisions); package suite 45/45.
  • Live-verified on the dev stack: fresh unsent session appears nowhere and pops into every list on its first message; View All opens real files and byte content renders; the sessions-with-mount path keeps the folded Agent/Session layout.

What to QA

  • Sessions page: no "Untitled session / No agent yet" placeholder rows; Load more only surfaces real conversations.
  • Sidebar sessions group: lists your recent real sessions even right after creating several blank ones in the playground.
  • Agent overview → Files → View All: the agent's files list and open.
  • Regression: automations/schedule rows still show in their lists; pinned sessions always show; a session with a session working directory still shows the folded agent-files/ layout in the playground Files panel.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 11, 2026
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Error Error Aug 12, 2026 9:16am

Request Review

@dosubot dosubot Bot added bug report Something isn't working frontend labels Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • release/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 95349e09-1d06-45d8-9c30-1cbb2fd0ccd9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Agent-only drives now display agent files directly at the drive root.
    • Sidebar session history supports up to 100 entries, shows agent names, excludes unstarted sessions, and preserves pinned sessions.
    • Session lists automatically load additional results when filtering leaves no visible sessions.
  • Bug Fixes

    • Improved agent-file navigation and selection paths.
    • Removed whole-drive file-count indicators from drive headers.
    • Improved loading behavior during errors and background fetching.
  • Tests

    • Added coverage for session filtering, pagination, agent-file handling, and sidebar limits.

Walkthrough

The PR adds agent-only drive support, changes drive metadata rendering, and filters unstarted sessions from lists and the sidebar. Session lists fetch more pages when filtering removes all visible rows.

Changes

Agent-only drive presentation

Layer / File(s) Summary
Agent-only drive resolution
web/oss/src/components/Drives/useSessionDrive.ts
Agent-only drives present agent files at the root and resolve paths directly against the agent mount.
Drive metadata display
web/oss/src/components/Drives/DriveExplorer.tsx, web/oss/src/components/Drives/DriveHeader.tsx, web/oss/src/components/pages/overview/agent/AgentFilesCard.tsx
Drive headers remove whole-drive count props. Folders show child counts, files show sizes, and agent file selection uses raw mount paths.

Started-session list filtering

Layer / File(s) Summary
Started-session policy
web/packages/agenta-sessions/src/state/sessionListPolicy.ts, web/packages/agenta-sessions/src/state/index.ts, web/packages/agenta-sessions/tests/unit/sessionListPolicy.test.ts
The session policy identifies started rows, filters them, determines when to load another page, exports the helpers, and tests these rules.
Session list and card integration
web/packages/agenta-sessions/src/state/useSessionsList.ts, web/packages/agenta-sessions/src/state/useSessionCardList.ts
Session lists filter unstarted rows, fetch additional pages when needed, and suppress empty states during top-up requests.
Sidebar session source
web/oss/src/components/Sidebar/dynamic/sessionOptions.ts, web/oss/src/components/Sidebar/dynamic/sessionsSource.ts, web/oss/src/components/Sidebar/dynamic/sessionOptions.test.ts
The sidebar limit increases to 100, recent rows exclude pinned or unstarted sessions, agent names are added to rows, and request-limit tests use shared constants.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DriveExplorer
  participant useSessionDrive
  participant AgentMount
  DriveExplorer->>useSessionDrive: request agent-only drive data
  useSessionDrive->>AgentMount: resolve root path
  AgentMount-->>useSessionDrive: return agent files
  useSessionDrive-->>DriveExplorer: render root-level files
Loading
sequenceDiagram
  participant useSessionsList
  participant sessionListPolicy
  participant SessionStream
  useSessionsList->>sessionListPolicy: filter loaded session rows
  sessionListPolicy->>SessionStream: inspect session start fields
  sessionListPolicy-->>useSessionsList: return started rows
  useSessionsList->>sessionListPolicy: check hidden-row pagination
  sessionListPolicy-->>useSessionsList: return top-up decision
Loading

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both primary changes: hiding empty sessions and connecting overview Files to the agent drive.
Description check ✅ Passed The description directly explains the empty-session filtering, agent-drive integration, pagination behavior, tests, and regression coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/empty-sessions-and-drive-views

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 44a2cacb-cb4b-4b2c-bb20-08f916d07343

📥 Commits

Reviewing files that changed from the base of the PR and between dad1982 and 83f677d.

📒 Files selected for processing (11)
  • web/oss/src/components/Drives/DriveExplorer.tsx
  • web/oss/src/components/Drives/DriveHeader.tsx
  • web/oss/src/components/Drives/useSessionDrive.ts
  • web/oss/src/components/Sidebar/dynamic/sessionOptions.ts
  • web/oss/src/components/Sidebar/dynamic/sessionsSource.ts
  • web/oss/src/components/pages/overview/agent/AgentFilesCard.tsx
  • web/packages/agenta-sessions/src/state/index.ts
  • web/packages/agenta-sessions/src/state/sessionListPolicy.ts
  • web/packages/agenta-sessions/src/state/useSessionCardList.ts
  • web/packages/agenta-sessions/src/state/useSessionsList.ts
  • web/packages/agenta-sessions/tests/unit/sessionListPolicy.test.ts
💤 Files with no reviewable changes (1)
  • web/oss/src/components/Drives/DriveExplorer.tsx

Comment thread web/oss/src/components/Drives/useSessionDrive.ts Outdated
Comment thread web/oss/src/components/Drives/useSessionDrive.ts Outdated
Comment thread web/packages/agenta-sessions/src/state/useSessionCardList.ts Outdated
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-5944.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-5944-a241ff5
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-12T09:28:03.333Z

@mmabrouk
mmabrouk force-pushed the fix/empty-sessions-and-drive-views branch from a16d7b6 to 57a092d Compare August 11, 2026 19:32
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 11, 2026
@mmabrouk
mmabrouk changed the base branch from release/v0.112.0 to feat/warm-recolor-and-playground-ux August 11, 2026 19:32
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 11, 2026
@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
✅ 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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 45a16f6a-f8cd-4ec6-9bc4-e379eff2afdf

📥 Commits

Reviewing files that changed from the base of the PR and between a16d7b6 and 57a092d.

📒 Files selected for processing (3)
  • web/oss/src/components/Sidebar/dynamic/sessionOptions.test.ts
  • web/oss/src/components/Sidebar/dynamic/sessionOptions.ts
  • web/oss/src/components/Sidebar/dynamic/sessionsSource.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/oss/src/components/Sidebar/dynamic/sessionOptions.test.ts

Comment thread web/oss/src/components/Sidebar/dynamic/sessionOptions.ts
@mmabrouk

Copy link
Copy Markdown
Member Author

Manual review — commit 57a092d9d9 (sidebar sessions: 14 rows + agent-name tooltips)

Posting this for the record. CodeRabbit's automated review is skipped on this PR because its base is a feature branch (feat/warm-recolor-and-playground-ux) rather than a release branch — and the skip renders as a green "CodeRabbit" check, which is easy to misread as "reviewed and clean". An on-demand @coderabbitai review did run and produced one comment on this commit (sidebar paging, answered in that thread), but this manual pass is the backstop for the rest of it.

One real finding, fixed in 35bb6b83.

sidebarSessionRefsAtom resolved the tooltip's agent name for every row in the request window, not just the rows that render. The ordering made this invisible: the atom mapped over all pinned rows plus all recent rows (a window of SIDEBAR_SESSION_LIMIT = 100), and the truncation to SIDEBAR_SESSION_VISIBLE_LIMIT = 14 happens later, in resolveChildren (refs.slice(0, entity.maxItems)).

That matters because workflowMolecule.selectors.artifactName(appId) is not a passive read. It subscribes to workflowArtifactQueryAtomFamily(artifactId), so each distinct agent id in the window can fire an artifact fetch. A project whose recent 100 sessions span, say, 20 agents would issue on the order of 20 artifact requests to populate tooltips for 14 rows — most of them for rows that are never rendered. Every one of those queries also becomes a dependency of sidebarSessionRefsAtom, so each resolution re-runs the whole derivation.

The fix keeps the full ref list intact (the "Show all" overflow count depends on refs.length) and resolves names only for the rendered prefix:

const refs = [
    ...pinnedRows.map((row) => toSidebarRef(row, pinned)).filter(isRef),
    ...recentRows.map((row) => toSidebarRef(row, pinned)).filter(isRef),
]
return refs.map((ref, index) =>
    index < SIDEBAR_SESSION_VISIBLE_LIMIT ? {...ref, agentName: agentNameOf(ref.appId)} : ref,
)

Rows past the cap never render a tooltip, so nothing user-visible changes. This also drops a duplicated sessionOpenTarget(row) call per row — it was being computed once for the appId and again inside toSidebarRef.

What I checked and found correct.

Reading the name off the workflow artifact rather than the revision is exactly right, and matches the repo's own rule that a revision's name carries the variant name and must never be used as an entity label. Gating on the group being open is a genuine saving — a closed Sessions group subscribes to nothing. Making SIDEBAR_SESSION_VISIBLE_LIMIT an exported constant and having the test assert SIDEBAR_SESSION_LIMIT > SIDEBAR_SESSION_VISIBLE_LIMIT * 2 is a good way to keep the two from drifting into each other, and it builds correctly on the constant-referencing assertions from the earlier fix rather than re-pinning literals.

Verified: tsc --noEmit clean on oss and ee, eslint and prettier clean, sidebar suites pass (4 files / 19 tests).

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@mmabrouk Thanks for the detailed manual review.

The fix correctly preserves refs.length for the overflow count while limiting artifact-query dependencies and tooltip name resolution to rendered rows. The artifact-name rule and the verification results provide useful context.

🐇


✏️ Learnings added
Learnt from: mmabrouk
URL: https://github.com/Agenta-AI/agenta/pull/5944

Timestamp: 2026-08-11T20:30:57.565Z
Learning: In `web/oss/src/components/Sidebar/dynamic/sessionsSource.ts`, `sidebarSessionRefsAtom` must retain the complete sidebar session reference list for the “Show all” overflow count, but it should resolve `workflowMolecule.selectors.artifactName(appId)` only for the first `SIDEBAR_SESSION_VISIBLE_LIMIT` rows that can render. Each artifact-name selector read subscribes to `workflowArtifactQueryAtomFamily(artifactId)`, so resolving names for the full `SIDEBAR_SESSION_LIMIT` request window causes unnecessary artifact requests and atom dependencies.

Learnt from: mmabrouk
URL: https://github.com/Agenta-AI/agenta/pull/5944

Timestamp: 2026-08-11T20:30:57.570Z
Learning: In the workflow UI, use the workflow artifact name as the entity label. Do not use a workflow revision `name` as an entity label because it identifies the variant.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
✅ 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.

@mmabrouk
mmabrouk force-pushed the fix/empty-sessions-and-drive-views branch from 3119b84 to ca3cb2e Compare August 12, 2026 08:28

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Aug 12, 2026
@mmabrouk
mmabrouk changed the base branch from feat/warm-recolor-and-playground-ux to release/v0.112.0 August 12, 2026 09:18
@mmabrouk
mmabrouk merged commit f0a873b into release/v0.112.0 Aug 12, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug report Something isn't working frontend lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant