Repository navigation
fix(sharing): clear stale pending access_request on team share + Sharing UX (#446) - #450
Merged
Merged
Conversation
…ing UX Team-shared users were still landing in the public-link approval queue because a prior chat attempt left a stale `access_requests` row that the owner saw as "pending" even after they added the email to Team Sharing. `share_agent` now atomically deletes any pending `(agent, email)` row so the Pending list reflects reality after a manual share. Also adds defense-in-depth email normalization (`.strip().lower()`) at every gate boundary — `email_has_agent_access`, `is_agent_shared_with_email`, `routers/public.py`, and both DM + group paths in `adapters/message_router.py` — so a mixed-case session email can never bypass the allow-list match. Restructures SharingPanel.vue to make the two-layer model explicit: identity proof (`require_email`) vs. authorization (Team Sharing allow-list + pending-approval queue). Adds a "Heads up" warning when `require_email` is on but no emails are in Team Sharing and `open_access` is off — the dead-end configuration that locks everyone out. New test file: `tests/test_team_share_gate_unit.py` (8 isolated unit tests over SharingMixin covering gate casing, stale-row cleanup scope, and normalization invariants). Closes #446 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds test_team_share_gate_unit.py to the Agent Lifecycle & Management category and a 2026-04-22 Recent Test Additions entry. Bumps suite stats: 122 files, ~2,219 total, ~98 unit, ~2,084 core. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Summary
share_agentnow atomically deletes any stale pendingaccess_requestsrow for the same(agent, email)so manually adding someone to Team Sharing clears the Pending list (closes the reported "team-shared user stays queued" symptom).email_has_agent_access,is_agent_shared_with_email,routers/public.py, both DM + group paths inadapters/message_router.py) now normalizesemail.strip().lower()so mixed-case session emails can't bypass the allow-list.SharingPanel.vuerestructured to make the two-layer model explicit — Identity Proof (require_emailproves who they are) vs. Authorization (Team Sharing allow-list + pending approval). Adds a dead-end warning banner whenrequire_email=true && !open_access && shares.length===0.Changes
src/backend/db/agent_settings/sharing.py—share_agentclears stale pending rows; input normalizedsrc/backend/routers/public.py— gate boundary normalizationsrc/backend/adapters/message_router.py— DM + group branch normalizationsrc/frontend/src/components/SharingPanel.vue— framing banner, renamed sections, dead-end warningtests/test_team_share_gate_unit.py— 8 new unit tests (casing, cleanup scope, no-op paths)agent-sharing.md,unified-channel-access-control.md)Test plan
pytest tests/test_team_share_gate_unit.py— 8/8 pass (run insidetrinity-backend)pytest tests/test_sharing_null_email_unit.py— 5/5 still pass (no regression)db.agent_settings.sharing,routers.public,adapters.message_router)SharingPanel.vuewithout errorsaccess_requestsrowCloses #446
🤖 Generated with Claude Code