Repository navigation
Conversation
Add five MCP tools for creating, verifying and editing Workflows email senders and for Domain Connect, typed request and response schemas for their endpoints, and scoped API key and OAuth access behind the workflows-email-domain-agent-setup flag. Add the setting-up-an-email-domain skill and its eval suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
This was referenced Oct 14, 2026
Regenerate the MCP tool inputs with the reply_to field, hide redirect_uri from the Domain Connect tool, mention reply-to in the guide and the skill, drop a duplicate test flag entry, and type the test auth headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
Closed
Contributor
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
This was referenced Oct 25, 2026
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
email/verify,PATCH emailand both Domain Connect actions, because none of them is in the viewset's scope lists.This recreates the fork drafts Silthus#343 and Silthus#352 on current master. Their earlier upstream drafts, #109703 and #113059, are closed.
Warning
🟡 Merge risk: medium · two-way door (merge-risk rubric)
workflows-email-domain-agent-setupis on. The web app's payloads match the serializers, and HTTP tests cover each route for session, API key and OAuth callers.Changes
Agents can take a domain from "add a sender" to "verified" over MCP, behind the default-off
workflows-email-domain-agent-setupflag. The backend checks the same flag, so turning it on enables the tools and the API access together.integrations-email-createintegrations-email-verify-createintegrations-domain-connect-check-retrieveintegrations-domain-connect-apply-url-createintegrations-email-partial-updateintegration:read); verify, apply-url and the update write (integration:write), because verify and apply-url call SES.email/verifyandPATCH emailon a non-email integration return 400 instead of 500.apply-urlreturns 404 for an unknown or non-emailintegration_id, and for an unknownproxy_record_id. Before, these returned 500 or a "try again later" 400.apply-urlaccepts aredirect_urionly when it points back to PostHog.PATCH emailwith a different address returns 400. The check ignores case.integrations-createtool stays disabled: it takes an untypedconfigfor 30+ kinds, including credentials.integrations-email-createreuses the same route withkind: emailinjected and a typed config.setting-up-an-email-domainskill teaches the flow, including SPF merging and keeping an existing DMARC record.eval_email_domain_setup, runs an agent with the skill against the real API over MCP, with SES, DNS and Domain Connect simulated per case.param_overrides.<field>.requirednow also works withinput_schema. Before, codegen ignored it.posthog/api/integration_domain_serializers.pywithhelp_text, and the OpenAPI types, MCP schemas, tool definitions and snapshots are regenerated.Note
Turn the flag on only after this PR has deployed to Django. The MCP server deploys separately, and until Django has the change every tool call returns 403.
Start with
EmailDomainAgentSetupPermissionand the four actions inposthog/api/integration.py. No web app screen changes.How did you test this code?
Test rationale:
TestEmailIntegrationScopedAccess(API key, OAuth and session, flag off/on/unresolved): fails if a token reaches verify or update with the flag off, or a session loses access. It also covers read-only scope, member role, a foreign integration, a project-restricted key and the read-only MCP policy. No existing test called these actions with a token.test_email_domain_actions_with_scoped_api_key(12 cases in the existing API key class): fails if an action moves between scope lists, if a response body changes shape, or ifapply-urlstops returning 404/403 for unknown, non-email or proxy requests.test_email_update_from_the_app_keeps_the_sender_address: fails if a sender stored with capitals cannot be edited, or if the address check runs with the flag off.test_integration_domain_serializers.py(SimpleTestCase): per-context required fields on apply-url, a malformedproxy_record_id, andmaildevoutsideDEBUG.products/workflows/evals/test/: the simulation runs the real SES provider and Domain Connect code; the scorers reject split SPF records and case-changed TXT values.context: proxy; the codegenrequiredoverride works withinput_schema; the sender tools appear only with the flag on.Ran locally on this head with an isolated test database (
--nomigrations):posthog/api/test/test_integration.py, the serializer, Domain Connect, email model and eval tests, and the MCP generator, filtering, apply-url and schema snapshot suites.hogli build:openapiandhogli build:schema-mcpregenerated cleanly, repo-wide mypy passed, andhogli ci:preflight --strictpassed.Not run: upstream CI beyond the draft subset, which waits for a maintainer to approve the fork runs. Also not run: the eval suite itself (it needs LLM gateway and Braintrust keys), a live MCP session against a running stack, real SES, or a real Domain Connect approval.
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Release status
Docs update
Updated the OAuth development guide with the sender and Domain Connect access that scoped credentials get while the flag is on.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (
claude-opus-5-5)eebb24a87c0, as one PR: Closes #351 client error when no actions defined #352 only adds tests and guide text for feature request: k8s documentation and improvements #343's routes and cannot land without it.reply_tofield from feat(workflows): add a default reply-to address to email senders #115898, the update tool description and an existing update test now cover it, and the eval SES simulation answers the new feedback forwarding call./improving-drf-endpoints,/implementing-mcp-tools,/writing-tests,/writing-pr-descriptions,pr,merge-risk,qa-swarm.tool-inputs.jsonwithoutreply_to,reply_tomissing from the guide and the skill, a duplicate test flag entry, and a mypy error in a new test. The apply-url tool now hidesredirect_uriinstead of asking the agent to omit it.integrations-email-partial-updateneeds the sender's currentname, and no read tool returns it. Makingnameoptional changes the API contract, so it is left for a separate PR.example.comand invented domains.🤖 Generated with Claude Code