Repository navigation
feat(llm): integrate GitLab DWS tool approval with permission system #19955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rekram1-node
merged 66 commits into
anomalyco:dev
from
vglafirov:feat/gitlab-dws-approval-integration
Apr 9, 2026
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
60be837
feat(llm): integrate GitLab DWS tool approval with permission system
vglafirov ee90930
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 4c160a4
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov c190a28
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 42c7ca3
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 68d3235
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 91a9f96
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov b3d99e3
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 5609fee
refactor(llm): address review feedback on DWS approval integration
vglafirov bb80f30
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 4179a5d
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 12f9923
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov fe343d8
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 2d3e70b
Merge branch 'dev' into feat/gitlab-dws-approval-integration
rekram1-node 20e6427
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 5b18a01
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 13420d1
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 60ceee0
Merge branch 'dev' into feat/gitlab-dws-approval-integration
rekram1-node 36be8d6
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov ba3b4e3
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 245684f
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov f164c2a
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 7524186
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 6825008
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 822ddd5
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 2644a8f
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 636f9fd
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 1477d7b
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 236c752
fix(gitlab): auto-approve previously approved DWS tools to prevent ap…
vglafirov ed879a1
fix: bump provider version
vglafirov 4f7f2e8
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 84c0e96
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 4bd6d84
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 3f25f79
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 8e11831
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 60f14fd
fix: skip tool parts that already completed
vglafirov 7c7c428
fix: skip provider executed tools
vglafirov b92393a
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 113594b
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 7e17b0c
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov a2f8621
merge: sync with upstream/dev and restore workflowDefinition passthrough
vglafirov 1219566
fix: gen types
vglafirov 3312d3f
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 06bb9a8
fix: fix after the review
vglafirov b4bcbfc
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 50f7124
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 3747eed
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 18ddb2b
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 104c4b3
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 78e1390
Merge branch 'dev' into feat/gitlab-dws-approval-integration
rekram1-node 838a7f4
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 9eadc49
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 8991c70
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov a34b859
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 8057397
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov d72cb78
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 1c9918d
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 61b223b
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 1042141
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 1a56160
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 5e6ab6e
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 420b394
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov c1c04fa
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 003c0a0
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 9d304a6
Merge branch 'dev' into feat/gitlab-dws-approval-integration
vglafirov 484e40a
fix: bump gitlab-ai-provider version
vglafirov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
feat(llm): integrate GitLab DWS tool approval with permission system
Wire approvalHandler and sessionPreapprovedTools on GitLabWorkflowLanguageModel
so that DWS tool-call approval checkpoints surface as opencode permission prompts.
- Set sessionPreapprovedTools from the merged agent+session ruleset so tools
without an explicit 'ask' rule are pre-approved for the DWS session
- Set approvalHandler (wrapped with Instance.bind to restore ALS context)
that delegates to Permission.ask with permission type 'workflow_tool_approval'
- Capture the Bus Replied event to detect 'always' replies and extend
sessionPreapprovedTools for subsequent DWS turns
- Return { approved: true/false } so approveAndResume reconnects with the
correct approval or rejection payload
- Bump gitlab-ai-provider to 6.1.0 which includes the approvalPending
stream-close deferral and rejection forwarding fixes
- Add preapprovedWorkflowTools helper (exported for testing) that filters
tools using findLast rule precedence matching ask-only exclusion- Loading branch information
commit 60be8377a3d782dbabfffd549c4452883a88ee8b
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
44 changes: 44 additions & 0 deletions
44
packages/opencode/test/session/gitlab-llm-workflow-approval.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { describe, expect, test } from "bun:test" | ||
| import { LLM } from "../../src/session/llm" | ||
| import type { Permission } from "../../src/permission" | ||
|
|
||
| describe("LLM.preapprovedWorkflowTools", () => { | ||
| test("returns all tools when ruleset is empty", () => { | ||
| const tools = ["read_file", "write_file", "run_command"] | ||
| const result = LLM.preapprovedWorkflowTools(tools, []) | ||
| expect(result).toEqual(tools) | ||
| }) | ||
|
|
||
| test("excludes tools with explicit ask rule", () => { | ||
| const tools = ["read_file", "run_command", "write_file"] | ||
| const ruleset: Permission.Ruleset = [{ permission: "run_command", pattern: "*", action: "ask" }] | ||
| const result = LLM.preapprovedWorkflowTools(tools, ruleset) | ||
| expect(result).not.toContain("run_command") | ||
| expect(result).toContain("read_file") | ||
| expect(result).toContain("write_file") | ||
| }) | ||
|
|
||
| test("excludes tools matched by wildcard ask rule", () => { | ||
| const tools = ["read_file", "write_file", "run_command"] | ||
| const ruleset: Permission.Ruleset = [{ permission: "*", pattern: "*", action: "ask" }] | ||
| const result = LLM.preapprovedWorkflowTools(tools, ruleset) | ||
| expect(result).toEqual([]) | ||
| }) | ||
|
|
||
| test("allows tools with allow rule overriding ask", () => { | ||
| const tools = ["run_command"] | ||
| const ruleset: Permission.Ruleset = [ | ||
| { permission: "*", pattern: "*", action: "ask" }, | ||
| { permission: "run_command", pattern: "*", action: "allow" }, | ||
| ] | ||
| const result = LLM.preapprovedWorkflowTools(tools, ruleset) | ||
| expect(result).toContain("run_command") | ||
| }) | ||
|
|
||
| test("preapproves tools with only deny rules (deny is handled by resolveTools, not here)", () => { | ||
| const tools = ["read_file"] | ||
| const ruleset: Permission.Ruleset = [{ permission: "read_file", pattern: "*", action: "deny" }] | ||
| const result = LLM.preapprovedWorkflowTools(tools, ruleset) | ||
| expect(result).toContain("read_file") | ||
| }) | ||
| }) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.