fix(kugetsu): add fix_session_permissions command for cmd_doctor #87

Closed
shoko wants to merge 1 commits from fix/issue-36-session-permissions into main
Owner

Summary

Fix for #36 - PM Agent external_directory permission fails.

Root Cause

The PM agent session was created with NULL permissions in SQLite, causing external_directory permission checks to fail.

Solution

Add fix_session_permissions() function that directly updates the opencode SQLite database to set proper permissions:

[
  {"permission":"question","pattern":"*","action":"deny"},
  {"permission":"plan_enter","pattern":"*","action":"deny"},
  {"permission":"plan_exit","pattern":"*","action":"deny"},
  {"permission":"external_directory","pattern":"*","action":"allow"}
]

Usage

kugetsu doctor --fix-permissions

This will update both base session and PM agent session permissions.

Fixes #36

## Summary Fix for #36 - PM Agent external_directory permission fails. ## Root Cause The PM agent session was created with NULL permissions in SQLite, causing external_directory permission checks to fail. ## Solution Add `fix_session_permissions()` function that directly updates the opencode SQLite database to set proper permissions: ```json [ {"permission":"question","pattern":"*","action":"deny"}, {"permission":"plan_enter","pattern":"*","action":"deny"}, {"permission":"plan_exit","pattern":"*","action":"deny"}, {"permission":"external_directory","pattern":"*","action":"allow"} ] ``` ## Usage ```bash kugetsu doctor --fix-permissions ``` This will update both base session and PM agent session permissions. Fixes #36
shoko added 1 commit 2026-04-02 01:18:46 +02:00
The PM agent session may be created with NULL permissions in SQLite,
causing 'external_directory' permission to fail.

Add fix_session_permissions() function that:
- Updates base session and PM agent session permissions in SQLite
- Sets external_directory pattern to '*' with action 'allow'

Add --fix-permissions flag to cmd_doctor:
  kugetsu doctor --fix-permissions

This directly updates the opencode SQLite database to fix the permissions.

Fixes #36
shoko closed this pull request 2026-04-02 02:57:39 +02:00

Pull request closed

Sign in to join this conversation.