P2 AI Agents integration surfaces#700
Conversation
Tested: make check; make test; npx vitest run tests/agent-actions-route.test.ts tests/agent-runs-context-links.test.ts; make test-e2e (blocked: local Postgres auth failed before Playwright ran) Confidence: high Co-authored-by: OmX <omx@oh-my-codex.dev>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 647cf84dba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return authResponse; | ||
| } | ||
|
|
||
| const access = await getWorkspaceAccess(session, request); |
There was a problem hiding this comment.
Constrain API-key actions to the key workspace
When this endpoint is called with a workspace-scoped API key, getWorkspaceAccess(session, request) still honors x-workspace-slug/referer before the API key's workspaceId, so a key minted for workspace A can POST this route with a slug for any other workspace where the key owner is a member and create agent runs there. The endpoint should ignore request-selected workspaces for API-key sessions or verify access.workspaceId === session.apiKey.workspaceId before proceeding.
Useful? React with 👍 / 👎.
| }); | ||
| const guidance = await resolveEffectiveAgentGuidance({ | ||
| workspaceId: access.workspaceId, | ||
| userId: mappedUserId ?? session.user.id, |
There was a problem hiding this comment.
Verify mapped actors belong to this workspace
Because resolveIntegrationActorUserId looks up provider/accountId globally, using the resulting id directly here lets a caller supply an actor.externalUserId that matches an account from another workspace; resolveEffectiveAgentGuidance then reads that user's account personalization and the response includes it in run.promptConfig. Verify the mapped user is a member of access.workspaceId (and ideally belongs to the connected integration) before using it, otherwise fall back to the session user or no mapping.
Useful? React with 👍 / 👎.
|
Controller intake: blocked before QA/merge. Current blocker:
Evidence:
Required before merge:
|
|
This PR's changed files are on the pre-monorepo-split Conflict resolution can't fix this — it needs to be rebuilt on the current architecture from the spec in #591 against current |
Summary
Verification
Closes #591