fix(session): exclude orphan org members from native pages - #804
Draft
ShiboSheng wants to merge 2 commits into
Draft
fix(session): exclude orphan org members from native pages#804ShiboSheng wants to merge 2 commits into
ShiboSheng wants to merge 2 commits into
Conversation
Filter orphan Agent Org member rows before native sidebar LIMITs so they no longer displace standalone or pinned sessions. Preserve valid coordinator roots through persisted Agent Org run membership. Verification: - cargo test -p agent_core core::session::persistence::sidebar::tests -- --nocapture (5 passed) - cargo test -p org2 pinned_native -- --nocapture (2 passed) - cargo check -p agent_core -p org2 --all-targets (passed) - cargo clippy -p agent_core -p org2 --all-targets -- -D warnings (passed) - pnpm run tauri:build:fast (passed); manual packaged-app acceptance passed Pre-commit hook ran. Total eslint: 0, total circular: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #803
The SDE sidebar could show only two normal sessions even when many more existed. Persisted Agent Org coordinator/member rows can keep
org_member_idwhile using a normal native session type and a null parent. The standalone query excluded live Agent Org roots but did not exclude these membership-marked orphan rows, and the pinned-native query accepted them unconditionally. Because both queries appliedLIMITafter those predicates, orphan rows consumed page capacity and displaced real SDE, OS, Human, or CLI sessions.The authoritative source is
agent_sessions, with live root identity supplied byagent_org_runs.root_session_id. Earlier UI/session pagination fixes did not cover stale coordinator rows whose run record no longer exists.Solution
agent_sessionsrow withorg_member_idfrom the standalone coding stream before keyset ordering andLIMIT.agent_org_runs.root_session_idproves it is a valid Agent Org root.This is a read-path invariant fix. It does not change schemas, migrations, RPC/wire formats, writers, or persisted historical rows.
Potential risks
org_member_idwill be hidden from the standalone stream; that is intentional because the field denotes Agent Org membership.agent_org_runs.root_session_idrecord. Regression tests cover retaining those roots in Agent Org and pinned views.EXPLAIN QUERY PLANverifiesidx_agent_sessions_sidebarandidx_agent_org_runs_root_sessionare used.Verification
cargo test -p agent_core core::session::persistence::sidebar::tests -- --nocapture— 5 passed, 0 failed.cargo test -p org2 pinned_native -- --nocapture— 2 passed, 0 failed.cargo fmt --all -- --check— passed.git diff --check— passed before commit;git diff --check origin/develop...HEADpassed after refreshing the PR base.cargo check -p agent_core -p org2 --all-targets— passed.cargo clippy -p agent_core -p org2 --all-targets -- -D warnings— passed; Cargo only reported the existing future-incompatibility note for dependencyblock v0.1.6.pnpm run tauri:build:fast— passed in 366.4s. Verified bundle:src-tauri/target/dev-build/bundle/macos/ORG2.app, version 1.2.5, SHA-25620073f8826307d075aa70cc547b7ce633ad2b2352a40e5cb235a7b96e6f4c76b.