Skip to content

Commit 7f0ee00

Browse files
authored
fix: ff scopes for agent skill program (#604)
1 parent 752c747 commit 7f0ee00

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/lib/agent/agent-runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export async function runProgram(
271271
projectId: session.projectId,
272272
email: session.email,
273273
region: session.region,
274+
programId: programConfig.id,
274275
});
275276

276277
session.credentials = { accessToken, projectApiKey, host, projectId };

src/lib/oauth/program-scopes.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@ export const MCP_TUTORIAL_SCOPE_ADDITIONS = [
100100
'subscription:read',
101101
] as const;
102102

103+
/**
104+
* Extra scopes the agent-skill program needs on top of `WIZARD_OAUTH_SCOPES`.
105+
*
106+
* Skills under this program (e.g. `creating-product-tours`) create feature
107+
* flags during the install flow. PostHog's consent grants exactly the scope
108+
* strings requested — `:write` does not imply `:read` — so listing existing
109+
* flags to avoid key collisions needs `feature_flag:read` explicitly.
110+
* `property_definition:read` lets the agent discover person properties when
111+
* building flag rollout filters instead of having to ask the user verbatim.
112+
*/
113+
export const AGENT_SKILL_SCOPE_ADDITIONS = [
114+
'feature_flag:read',
115+
'feature_flag:write',
116+
'property_definition:read',
117+
] as const;
118+
103119
/**
104120
* Per-program scope additions, layered on top of `WIZARD_OAUTH_SCOPES`.
105121
*
@@ -117,6 +133,7 @@ const PROGRAM_SCOPE_ADDITIONS: Partial<Record<ProgramId, readonly string[]>> = {
117133
// key constraint catches renames at compile time — if `mcpTutorialConfig.id`
118134
// ever changes, this line will fail to type-check.
119135
'mcp-tutorial': MCP_TUTORIAL_SCOPE_ADDITIONS,
136+
'agent-skill': AGENT_SKILL_SCOPE_ADDITIONS,
120137
};
121138

122139
/**

src/lib/runners/run-wizard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export function runWizard(
110110
ci: session.ci,
111111
apiKey: session.apiKey,
112112
projectId: session.projectId,
113+
programId: config.id,
113114
});
114115
activeTui.store.setCredentials({
115116
accessToken,

0 commit comments

Comments
 (0)