Skip to content

fix(invites): agent share invite links to FRONTEND_URL only (abilityai/trinity-enterprise#1255) - #4539

Merged
obasilakis merged 2 commits into
devfrom
feature/1255-invite-link-host
Nov 13, 2026
Merged

obasilakis merged 2 commits into
devfrom
feature/1255-invite-link-host

Conversation

@obasilakis

Copy link
Copy Markdown
Contributor

Summary

  • agent_invite_service._workspace_url() reads FRONTEND_URL only. It no longer falls back to the public chat URL, whose host serves only chat (the /workspace link was a 403).
  • With FRONTEND_URL empty, the email carries no button and says "on your Trinity sign-in page, in the Workspace", the existing no-URL path.
  • .env.example: FRONTEND_URL must be set whenever PUBLIC_CHAT_URL is. 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_URL set and FRONTEND_URL unset, so no link and no public host in the mail.
  • .env.example: comment.

Test Plan

  • New test is red without the fix and green with it.
  • 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_URL on managed instances).

Refs abilityai/trinity-enterprise#1255

🤖 Generated with Claude Code

obasilakis and others added 2 commits November 13, 2026 15:26
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]>

@AndriiPasternak31 AndriiPasternak31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. The deploy guides now contradict the new rule. docs/user-docs/guides/deploying/public-access.md:95 still says "Also set FRONTEND_URL if it differs from PUBLIC_CHAT_URL", and single-server.md:135 says PUBLIC_CHAT_URL is "Often the same as FRONTEND_URL". An operator who followed those (only PUBLIC_CHAT_URL set) had working invite links before; after this PR the email has no button. That's an acceptable downgrade, but the guides should say "always set FRONTEND_URL". Also, .env.example says the public host "blocks /login and /workspace", which isn't true for the catch-all setup public-access.md documents. "May block" would be accurate.

  2. Merge order. The .env.example line "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.

  3. Follow-up, outside this diff: src/backend/services/slack_service.py:666 (get_oauth_callback_redirect) has the same FRONTEND_URL or get_public_chat_url() fallback, so after Slack OAuth an admin can land on the public host's 403 for /settings or /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.

@obasilakis
obasilakis merged commit 54f663a into dev Nov 13, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants