Skip to content

fix(agent): declare granted write actions in draft access summary - #93

Merged
ripgrim merged 1 commit into
mainfrom
rg/cmp-70-draft-access-writes
Aug 8, 2026
Merged

fix(agent): declare granted write actions in draft access summary#93
ripgrim merged 1 commit into
mainfrom
rg/cmp-70-draft-access-writes

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Opened automatically when rg/cmp-70-draft-access-writes was pushed.

The title is written from the diff and rewritten as you push, because this is squashed onto main and the title becomes the commit subject and the changelog line. Retitle it yourself and it is yours — the automation stops touching it.


Summary by cubic

Update draft access summaries to include granted write actions from crm.activity.create (notes, tasks) so users see accurate permissions.

  • Bug Fixes
    • Add "Write notes on CRM records" and "Create tasks on CRM records" based on granted activity types.
    • Only list granted types; keep read-only drafts read-only; no duplicates; fixed order (NOTE, TASK).
    • Add tests to cover mixed activity types, deduping, and read-only behavior.

Written for commit 115e468. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
crm-agent Ready Ready Preview Aug 8, 2026 8:03am
crm-api Ready Ready Preview Aug 8, 2026 8:03am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
crm-app Skipped Skipped Aug 8, 2026 8:03am

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/agent/agent/subagents/agent_builder/lib/draft-input.ts">

<violation number="1" location="apps/agent/agent/subagents/agent_builder/lib/draft-input.ts:48">
P3: The new write-access map duplicates the activity-type enum already defined in the builderDraftToolInput zod schema (`z.enum(["NOTE", "TASK"])`). There's no linkage between the two, so if a new activity type is later allowed in the schema, it would silently disappear from the draft access declaration: it wouldn't be in ACTIVITY_ORDER or ACTIVITY_ACCESS, and no type error would surface because both are standalone `as const` constants. Consider deriving the access map keys/order from a single shared constant (e.g. exporting the activity-type enum from the schema and keying ACTIVITY_ACCESS off it as a `Record<ActivityType, string>`), so adding a type to the schema forces awareness of the corresponding access label.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic


type BuilderDraftToolInput = z.infer<typeof builderDraftToolInput>;

const ACTIVITY_ACCESS = {

@cubic-dev-ai cubic-dev-ai Bot Aug 8, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new write-access map duplicates the activity-type enum already defined in the builderDraftToolInput zod schema (z.enum(["NOTE", "TASK"])). There's no linkage between the two, so if a new activity type is later allowed in the schema, it would silently disappear from the draft access declaration: it wouldn't be in ACTIVITY_ORDER or ACTIVITY_ACCESS, and no type error would surface because both are standalone as const constants. Consider deriving the access map keys/order from a single shared constant (e.g. exporting the activity-type enum from the schema and keying ACTIVITY_ACCESS off it as a Record<ActivityType, string>), so adding a type to the schema forces awareness of the corresponding access label.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/agent/agent/subagents/agent_builder/lib/draft-input.ts, line 48:

<comment>The new write-access map duplicates the activity-type enum already defined in the builderDraftToolInput zod schema (`z.enum(["NOTE", "TASK"])`). There's no linkage between the two, so if a new activity type is later allowed in the schema, it would silently disappear from the draft access declaration: it wouldn't be in ACTIVITY_ORDER or ACTIVITY_ACCESS, and no type error would surface because both are standalone `as const` constants. Consider deriving the access map keys/order from a single shared constant (e.g. exporting the activity-type enum from the schema and keying ACTIVITY_ACCESS off it as a `Record<ActivityType, string>`), so adding a type to the schema forces awareness of the corresponding access label.</comment>

<file context>
@@ -45,6 +45,13 @@ export const builderDraftToolInput = z.object({
 
 type BuilderDraftToolInput = z.infer<typeof builderDraftToolInput>;
 
+const ACTIVITY_ACCESS = {
+	NOTE: "Write notes on CRM records",
+	TASK: "Create tasks on CRM records",
</file context>
Fix with cubic

@ripgrim
ripgrim merged commit ad4f9f3 into main Aug 8, 2026
9 checks passed
@ripgrim
ripgrim deleted the rg/cmp-70-draft-access-writes branch August 8, 2026 08:08
This was referenced Aug 8, 2026
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.

1 participant