Skip to content

Commit 18d23cb

Browse files
committed
fix(gitlab): apply 10-agent validation findings across all 62 tools
- MR draft flag now applied via Draft: title prefix (GitLab has no draft body param) - update_user only sends admin when a real boolean (untouched switch serialized null and could demote admins) - add_member 409 soft-success now verified against the conflict body - auto_merge sent alongside deprecated merge_when_pipeline_succeeds - job log capped at 200k chars, file content at 1M chars, with truncated outputs - MR diffs signal hasMore beyond 100 files - wire dropped params: update_issue milestoneId, MR milestone/squash/removeSourceBranch, pipelines ref, tree ref, branches search, commits since/until/path/author, update_file lastCommitId, jobs includeRetried, create_user forceRandomPassword - complete pipeline/job status enums, access-level enums, widen stale type unions - guards: update_invitation requires a change; create_user requires a password strategy - fix double-encoding trap in path descriptions; doc-accuracy touch-ups
1 parent c70a497 commit 18d23cb

56 files changed

Lines changed: 483 additions & 189 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/docs/content/docs/en/integrations/gitlab.mdx

Lines changed: 99 additions & 79 deletions
Large diffs are not rendered by default.

apps/sim/blocks/blocks/gitlab.ts

Lines changed: 188 additions & 20 deletions
Large diffs are not rendered by default.

apps/sim/tools/gitlab/access.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ describe('gitlab_add_member', () => {
7979

8080
it('treats a 409 as a soft success so workflows are re-runnable', async () => {
8181
const result = await gitlabAddMemberTool.transformResponse!(
82-
mockResponse({ ok: false, status: 409, json: { message: 'Member already exists' } }),
82+
mockResponse({
83+
ok: false,
84+
status: 409,
85+
json: { message: 'Member already exists' },
86+
text: '{"message":"Member already exists"}',
87+
}),
8388
{} as never
8489
)
8590
expect(result.success).toBe(true)
@@ -96,6 +101,14 @@ describe('gitlab_add_member', () => {
96101
expect(result.output.member).toEqual({ id: 7, access_level: 30 })
97102
})
98103

104+
it('surfaces a 409 that is not an already-member conflict as a failure', async () => {
105+
const result = await gitlabAddMemberTool.transformResponse!(
106+
mockResponse({ ok: false, status: 409, text: '{"message":"Seat limit reached"}' }),
107+
{} as never
108+
)
109+
expect(result.success).toBe(false)
110+
})
111+
99112
it('surfaces other errors as hard failures', async () => {
100113
const result = await gitlabAddMemberTool.transformResponse!(
101114
mockResponse({ ok: false, status: 403, text: 'Forbidden' }),

apps/sim/tools/gitlab/add_member.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const gitlabAddMemberTool: ToolConfig<GitLabAddMemberParams, GitLabAddMem
3131
type: 'string',
3232
required: true,
3333
visibility: 'user-or-llm',
34-
description: 'Project or group ID or URL-encoded path',
34+
description: 'Project or group ID or path (e.g. mygroup/myproject)',
3535
},
3636
userId: {
3737
type: 'number',
@@ -44,7 +44,7 @@ export const gitlabAddMemberTool: ToolConfig<GitLabAddMemberParams, GitLabAddMem
4444
required: true,
4545
visibility: 'user-or-llm',
4646
description:
47-
'Access level: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner)',
47+
'Access level: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner)',
4848
},
4949
expiresAt: {
5050
type: 'string',
@@ -84,14 +84,23 @@ export const gitlabAddMemberTool: ToolConfig<GitLabAddMemberParams, GitLabAddMem
8484
},
8585

8686
transformResponse: async (response) => {
87-
// A 409 means the user is already a member. Treat it as a soft success so
88-
// provisioning workflows remain safely re-runnable.
87+
// A 409 with "already exists" means the user is already a member. Treat it
88+
// as a soft success so provisioning workflows remain safely re-runnable —
89+
// but only for that specific conflict, so other 409s still surface.
8990
if (response.status === 409) {
91+
const conflictText = await response.text()
92+
if (/already exists|already a member/i.test(conflictText)) {
93+
return {
94+
success: true,
95+
output: {
96+
alreadyMember: true,
97+
},
98+
}
99+
}
90100
return {
91-
success: true,
92-
output: {
93-
alreadyMember: true,
94-
},
101+
success: false,
102+
error: `GitLab API error: 409 ${conflictText}`,
103+
output: {},
95104
}
96105
}
97106

apps/sim/tools/gitlab/add_saml_group_link.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const gitlabAddSamlGroupLinkTool: ToolConfig<
1212
id: 'gitlab_add_saml_group_link',
1313
name: 'GitLab Add SAML Group Link',
1414
description:
15-
'Add a SAML group link that maps an identity-provider group to a GitLab group at a given access level',
15+
'Add a SAML group link that maps an identity-provider group to a GitLab group at a given access level (GitLab Premium/Ultimate)',
1616
version: '1.0.0',
1717

1818
params: {
@@ -32,7 +32,7 @@ export const gitlabAddSamlGroupLinkTool: ToolConfig<
3232
type: 'string',
3333
required: true,
3434
visibility: 'user-or-llm',
35-
description: 'Group ID or URL-encoded path',
35+
description: 'Group ID or path (e.g. my-org/my-group)',
3636
},
3737
samlGroupName: {
3838
type: 'string',
@@ -45,7 +45,7 @@ export const gitlabAddSamlGroupLinkTool: ToolConfig<
4545
required: true,
4646
visibility: 'user-or-llm',
4747
description:
48-
'Access level granted to members of the SAML group: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner)',
48+
'Access level granted to members of the SAML group: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner)',
4949
},
5050
memberRoleId: {
5151
type: 'number',
@@ -57,7 +57,8 @@ export const gitlabAddSamlGroupLinkTool: ToolConfig<
5757
type: 'string',
5858
required: false,
5959
visibility: 'user-or-llm',
60-
description: 'Unique provider name that must match for this group link to be applied',
60+
description:
61+
'Unique provider name that must match for this group link to be applied (GitLab 18.2+)',
6162
},
6263
},
6364

apps/sim/tools/gitlab/approve_access_request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const gitlabApproveAccessRequestTool: ToolConfig<
3737
type: 'string',
3838
required: true,
3939
visibility: 'user-or-llm',
40-
description: 'Project or group ID or URL-encoded path',
40+
description: 'Project or group ID or path (e.g. mygroup/myproject)',
4141
},
4242
userId: {
4343
type: 'number',
@@ -50,7 +50,7 @@ export const gitlabApproveAccessRequestTool: ToolConfig<
5050
required: false,
5151
visibility: 'user-or-llm',
5252
description:
53-
'Access level to grant: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner). Defaults to 30 (Developer).',
53+
'Access level to grant: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), 50 (Owner). Defaults to 30 (Developer).',
5454
},
5555
},
5656

apps/sim/tools/gitlab/approve_merge_request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const gitlabApproveMergeRequestTool: ToolConfig<
3131
type: 'string',
3232
required: true,
3333
visibility: 'user-or-llm',
34-
description: 'Project ID or URL-encoded path',
34+
description: 'Project ID or path (e.g. mygroup/myproject)',
3535
},
3636
mergeRequestIid: {
3737
type: 'number',

apps/sim/tools/gitlab/cancel_pipeline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const gitlabCancelPipelineTool: ToolConfig<
2828
type: 'string',
2929
required: true,
3030
visibility: 'user-or-llm',
31-
description: 'Project ID or URL-encoded path',
31+
description: 'Project ID or path (e.g. mygroup/myproject)',
3232
},
3333
pipelineId: {
3434
type: 'number',

apps/sim/tools/gitlab/compare_branches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const gitlabCompareBranchesTool: ToolConfig<
3131
type: 'string',
3232
required: true,
3333
visibility: 'user-or-llm',
34-
description: 'Project ID or URL-encoded path',
34+
description: 'Project ID or path (e.g. mygroup/myproject)',
3535
},
3636
from: {
3737
type: 'string',

apps/sim/tools/gitlab/create_branch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const gitlabCreateBranchTool: ToolConfig<
2828
type: 'string',
2929
required: true,
3030
visibility: 'user-or-llm',
31-
description: 'Project ID or URL-encoded path',
31+
description: 'Project ID or path (e.g. mygroup/myproject)',
3232
},
3333
branch: {
3434
type: 'string',

0 commit comments

Comments
 (0)