Skip to content

feat(permissions): always allow in this workspace, written to the workspace's opencode.json - #4292

Closed
reachjalil wants to merge 4 commits into
devfrom
workspace-permission-rules
Closed

reachjalil wants to merge 4 commits into
devfrom
workspace-permission-rules

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

Summary

The approval prompt can save “Always allow in this workspace” rules to that workspace's opencode.json. Settings lists the saved rules and lets the user remove them. Rules use the engine's suggested patterns and preserve the file's comments and existing entries.

The effective-permissions parent #4290 has already merged. This PR now targets current dev directly; #4293 remains its dependent run-mode change. The existing effective-permissions summary stays in Advanced, while the new rule editor appears in Permissions.

Verification

Verdict: Incomplete. Refreshed head: 508b9255c.

  • Passed: 6 server file/route/engine component checks using the pinned OpenCode 1.18.18 binary. They cover narrow rule application and revocation, comments, collaborator writes, and viewer denial.
  • Passed: 8 approval-panel and workspace-rule UI checks.
  • Passed: app and server typechecks, whitespace check, and journey-boundary ratchet.
  • Deferred: a real application journey through the approval button and Settings at this head. The engine component test imports product helpers, so it now lives beside the server module; its passing result is not presented as testkit journey evidence.

An initial local engine check failed because the installed engine was 1.18.15; rerunning with the repository-pinned 1.18.18 passed. Current upstream CI and Warden must complete on the refreshed head before merging.

@vercel

vercel Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 5, 2026 12:38am UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 5, 2026 12:38am UTC
openwork-diagnostics Skipped Skipped Sep 5, 2026 12:38am UTC
openwork-landing Skipped Skipped Sep 5, 2026 12:38am UTC

@reachjalil

Copy link
Copy Markdown
Member Author

Test evidence — a-rule-saved-into-the-workspace-s-opencode-json-is-read-by-the-engine-as-the-las — 0/0 screenshots passed · 2 assertions

✅ 0/0 screenshots passed · 2 assertions · 2 expectations passed · 0 failed · 0 pending

screenshots not uploaded (no BLOB_READ_WRITE_TOKEN)

ℹ️ ASSERTION — 1. An allow rule saved from a prompt is enforced by the engine for exactly that pattern and attributed to the workspace file

bash "git status --porcelain" ask → allow (source workspace); "git push" and "rm -rf" still ask; the file's comment survived.

  • ✅ PASS An allow rule saved from a prompt is enforced by the engine for exactly that pattern and attributed to the workspace file — bash "git status --porcelain" ask → allow (source workspace); "git push" and "rm -rf" still ask; the file's comment survived.

ℹ️ ASSERTION — 2. Removing the saved rule restores the previous decision

bash "git status --porcelain" is back to ask after the entry was removed from opencode.json.

  • ✅ PASS Removing the saved rule restores the previous decision — bash "git status --porcelain" is back to ask after the entry was removed from opencode.json.

Test run created 2026-09-02T00:13:12.893Z · Source: evals/results/test-runs/2026-09-02T00-13-12-893Z-a-rule-saved-into-the-workspace-s-opencode-json-is-read-by-the-engine-as-the-las/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4292 --test-run 2026-09-02T00-13-12-893Z-a-rule-saved-into-the-workspace-s-opencode-json-is-read-by-the-engine-as-the-las

@benjaminshafii

Copy link
Copy Markdown
Member

@OmarMcAdam Please review persistent workspace permission writes, host approval and revocation semantics, plus the stack base before merging. #4293 also contains an explicit permission-policy decision requiring review.

Holding for your review under the current merge instructions.

…kspace's opencode.json

The approval prompt gains "Always allow in this workspace" beside "Allow for
session". It replies "always" to the engine exactly as before and also writes
the engine's own suggested patterns as allow entries under that permission in
the workspace's opencode.json — the layer the engine reads last, visible in
the repository, and exactly what an OpenCode user would write by hand.

Settings > Permissions lists the permission rules of that file with a remove
button per entry, so anything saved from a prompt (or written by hand) can be
seen and revoked in the same place. Edits preserve the file's comments and
formatting; string shorthand is expanded rather than overwritten; a removed
entry that empties its permission object removes the object too.

Routes: GET/POST/DELETE /workspace/:id/permissions/rules (client auth; writes
require collaborator scope, host approval as config.write, and are audited;
a real change records a config reload event). OpenWork stores nothing of its
own for these rules.
- File edits: comments survive, string shorthand expands, duplicates are not
  written twice, removals drop emptied objects; routes list/add/remove for
  collaborators and refuse viewer writes, recording a config reload event.
- Real engine (workspace-permission-rules-engine): an allow entry written
  for the engine's suggested pattern flips exactly that command from ask to
  allow and is attributed to the workspace file; other commands still ask;
  removing the entry restores ask.
- UI: the prompt offers the workspace-wide reply after the session one and
  disables it when the file cannot be edited; the Settings list explains
  itself and shows nothing before the server answers.
@reachjalil
reachjalil changed the base branch from effective-permissions-view to dev September 5, 2026 00:36
@reachjalil
reachjalil force-pushed the workspace-permission-rules branch from 616e905 to 508b925 Compare September 5, 2026 00:36
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 5, 2026 00:37 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 5, 2026 00:37 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 5, 2026 00:37 Inactive

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (508b9255cf21c3fbd2262083bd21cf49501a9b9f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3d98392
Status: ✅  Deploy successful!
Preview URL: https://6ee63337.openwork.pages.dev
Branch Preview URL: https://workspace-permission-rules.openwork.pages.dev

View logs

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Deployment failed for project openwork-diagnostics with the following error:

Too many requests - try again in 5 minutes (more than 120, code: "api-deployments-flood-pro").

Learn More: https://vercel.com/docs/limits#rate-limits

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Deployment failed for project openwork-app with the following error:

Too many requests - try again in 5 minutes (more than 120, code: "api-deployments-flood-pro").

Learn More: https://vercel.com/docs/limits#rate-limits

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Deployment failed for project openwork-den with the following error:

Too many requests - try again in 5 minutes (more than 120, code: "api-deployments-flood-pro").

Learn More: https://vercel.com/docs/limits#rate-limits

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Deployment failed for project openwork-landing with the following error:

Too many requests - try again in 5 minutes (more than 120, code: "api-deployments-flood-pro").

Learn More: https://vercel.com/docs/limits#rate-limits

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (3d98392872905654c831d369452a89c54b1a2832). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants