fix(frontend): select the session cwd mount by name, order mount listings deterministically - #5642
Conversation
…ings deterministically
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Railway Preview Environment
|
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 onmounts[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
pickCwdMounthelper in@agenta/entities/session: match byname === "cwd"first (the API returns it on every response), then a__cwdslug-suffix fallback, then the old first-mount fallback. Used at all three call sites so they cannot drift again.ORDER BY created_at, idwhen 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_atout of insertion order and fails with the ORDER BY removed (verified by mutation).https://claude.ai/code/session_01McMogkcDRV7UpSAjfd8VKG