Skip to content

fix(frontend): select the session cwd mount by name, order mount listings deterministically - #5642

Merged
mmabrouk merged 1 commit into
release/v0.107.0from
fix/drawer-cwd-mount-selection
Aug 1, 2026
Merged

fix(frontend): select the session cwd mount by name, order mount listings deterministically#5642
mmabrouk merged 1 commit into
release/v0.107.0from
fix/drawer-cwd-mount-selection

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Aug 1, 2026

Copy link
Copy Markdown
Member

What was broken

On staging, the Files drawer sometimes showed an empty tree with no session-files option even though the agent had written files into the session workspace (reported by Mahmoud during release QA, reproduced live).

Cause

The drawer picked the working-directory mount with mounts.find((m) => m.slug === "cwd"), but the wire slug has been the minted reserved slug (__ag__session__<uuid5>__cwd) since before that line was written, so the selector never matched once and every drawer ran on mounts[0]: an UNORDERED SQL result. When a sibling mount (pi-sessions) happened to come back first, the drawer pointed at the wrong mount: empty tree, and the All/Agent/Session control never rendered. Pre-existing since the drive surfaces landed (byte-identical in v0.106.2); plausibly surfaced now because the release's new query predicates can flip the arbitrary row order.

Fix

  • New pickCwdMount helper in @agenta/entities/session: match by name === "cwd" first (the API returns it on every response), then a __cwd slug-suffix fallback, then the old first-mount fallback. Used at all three call sites so they cannot drift again.
  • The mounts DAO applies a stable ORDER BY created_at, id when no windowing is passed, so no consumer depends on undefined row order.

Tests

Helper unit tests (name beats position, suffix fallback, empty list) and a DB-backed ordering test that stamps created_at out of insertion order and fails with the ORDER BY removed (verified by mutation).

https://claude.ai/code/session_01McMogkcDRV7UpSAjfd8VKG

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 1, 2026 8:21pm

Request Review

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug Report Something isn't working Frontend labels Aug 1, 2026
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Important

Review skipped

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

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7680aeeb-ce16-4a78-8bf0-80dbb5f3f241

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

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.

@mmabrouk
mmabrouk merged commit f913119 into release/v0.107.0 Aug 1, 2026
33 checks passed
@mmabrouk
mmabrouk deleted the fix/drawer-cwd-mount-selection branch August 1, 2026 20:25
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-cf6f.up.railway.app/w
Project agenta-oss-pr-5642
Image tag pr-5642-4c1d907
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-01T20:32:41.300Z

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 size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant