Skip to content

fix(opencode): expose permission on session update route and expand patterns#15118

Open
jquense wants to merge 1 commit intoanomalyco:devfrom
jquense:feat/session-update-permission
Open

fix(opencode): expose permission on session update route and expand patterns#15118
jquense wants to merge 1 commit intoanomalyco:devfrom
jquense:feat/session-update-permission

Conversation

@jquense
Copy link
Contributor

@jquense jquense commented Feb 25, 2026

Issue for this PR

Closes #15116
Fixes #10212
Fixes #5965

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

PATCH /session/{sessionID} doesn't accept a permission field, even though POST /session does. This adds it, and also runs expandRuleset (resolves ~/ and $HOME in patterns) in both the create and update route handlers. Without this, permission patterns passed via the API with ~/ or $HOME are stored literally and never match — unlike patterns from opencode.jsonc which go through fromConfig and get expanded.

Changes:

  • Added permission to the PATCH session route validator and handler
  • Exported expandRuleset() from PermissionNext
  • Both POST and PATCH session handlers now expand patterns before storing
  • Regenerated SDK v2 types

How did you verify your code works?

  • tsgo --noEmit passes
  • Wrote a test script against a local dev server that creates and updates sessions with ~/ and $HOME patterns, confirmed they are expanded to the absolute home directory path
  • Confirmed generated SessionUpdateData type includes permission?: PermissionRuleset

Screenshots / recordings

N/A — no UI changes

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. contributor labels Feb 25, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Feb 25, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Projects

None yet

1 participant