feat(agent): route slack-originated tasks to slack_app gateway product#2225
Draft
VojtechBartos wants to merge 1 commit into
Draft
feat(agent): route slack-originated tasks to slack_app gateway product#2225VojtechBartos wants to merge 1 commit into
VojtechBartos wants to merge 1 commit into
Conversation
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
The agent in the sandbox calls the LLM gateway as
posthog_coderegardless of how the task started. Slack-bot mentions are now billed differently from desktop tasks (gateway tagsslack_apptraffic with\$ai_billable=true), so the agent needs to send the correct product per task.Changes
"slack_app"to theGatewayProducttype union (packages/agent/src/utils/gateway.ts)."slack"to theTask.origin_productunion (packages/agent/src/types.ts) to mirror the PythonTask.OriginProduct.SLACKvalue already set on the backend.configureEnvironmentnow acceptsoriginProduct?: Task["origin_product"] | null. Mapping:"slack"→slack_app,internal=true→background_agents, else →posthog_code. Call site readspreTask?.origin_productfrom the Task fetched at session init.Pairs with PostHog/posthog#59040 (gateway-side product registration + per-turn quota gate). Both ship behind the existing
posthog-code-slack-availabilityflag — neither side has user-visible effect until the flag is enabled.How did you test this?
I'm an agent. No manual testing.
pnpm --filter @posthog/agent test src/server/agent-server.configure-environment.test.ts→ 8 passed (5 pre-existing + 3 new).biome format --writeclean on touched files.Publish to changelog?
no