Repository navigation
fix(invites): agent share invite links to FRONTEND_URL only (abilityai/trinity-enterprise#1255) - #4539
Conversation
The agent share invite fell back to the public chat URL when FRONTEND_URL was unset. The public host serves only chat, so the /workspace link was a 403. With FRONTEND_URL empty the email now carries no link and keeps the existing "on your Trinity sign-in page" wording. .env.example says FRONTEND_URL must be set whenever PUBLIC_CHAT_URL is. Refs Abilityai/trinity-enterprise#1255 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AndriiPasternak31
left a comment
There was a problem hiding this comment.
Approving: the code change is correct. Invite links now build only from FRONTEND_URL, a trailing slash is handled, an unset value falls back to the no-link wording, and FRONTEND_URL is wired in all three compose files. The new test goes red on a revert. A few docs to bring in line, ideally in this PR:
-
The deploy guides now contradict the new rule.
docs/user-docs/guides/deploying/public-access.md:95still says "Also setFRONTEND_URLif it differs fromPUBLIC_CHAT_URL", andsingle-server.md:135saysPUBLIC_CHAT_URLis "Often the same asFRONTEND_URL". An operator who followed those (onlyPUBLIC_CHAT_URLset) had working invite links before; after this PR the email has no button. That's an acceptable downgrade, but the guides should say "always setFRONTEND_URL". Also,.env.examplesays the public host "blocks /login and /workspace", which isn't true for the catch-all setuppublic-access.mddocuments. "May block" would be accurate. -
Merge order. The
.env.exampleline "Invite emails take their sign-in link from FRONTEND_URL only" isn't true for member invites until the enterprise twin (ent#1262) lands and the submodule pointer is bumped. That's fine if they ship together. -
Follow-up, outside this diff:
src/backend/services/slack_service.py:666(get_oauth_callback_redirect) has the sameFRONTEND_URL or get_public_chat_url()fallback, so after Slack OAuth an admin can land on the public host's 403 for/settingsor/agents/.... Worth its own issue.
Nit: the test only sets the PUBLIC_CHAT_URL env var. A variant that sets the public_chat_url setting would cover the Settings → General source too.
Summary
agent_invite_service._workspace_url()readsFRONTEND_URLonly. It no longer falls back to the public chat URL, whose host serves only chat (the/workspacelink was a 403).FRONTEND_URLempty, the email carries no button and says "on your Trinity sign-in page, in the Workspace", the existing no-URL path..env.example:FRONTEND_URLmust be set wheneverPUBLIC_CHAT_URLis. The old "auto-detect from request headers" line is removed; no invite path reads request headers.Changes
src/backend/services/agent_invite_service.py: drop the fallback and the unused import.tests/unit/test_ent459_operator_invite.py: new test,PUBLIC_CHAT_URLset andFRONTEND_URLunset, so no link and no public host in the mail..env.example: comment.Test Plan
cd tests && pytest unit/test_ent459_operator_invite.py unit/test_ent549_file_audience.py unit/test_ent719_reach_and_exposure_human_only.py -p no:randomly: 454 passed.Member-invite twin: abilityai/trinity-enterprise#1262 (independent, no pointer bump here; the bump follows its merge). Issue stays open for the ops step (set
FRONTEND_URLon managed instances).Refs abilityai/trinity-enterprise#1255
🤖 Generated with Claude Code