Skip to content

fix-agent-perms → main#5

Merged
chriswritescode-dev merged 4 commits intomainfrom
fix-agent-perms
Apr 21, 2026
Merged

fix-agent-perms → main#5
chriswritescode-dev merged 4 commits intomainfrom
fix-agent-perms

Conversation

@chriswritescode-dev
Copy link
Copy Markdown
Owner

  • fix(agent-perms): resolve permission handling and refactor index
  • fix(permission): use worktreeDir to identify worktree loops
  • refactor: extract permission handler and add directory-based session resolution

- Add database connection caching in src/storage/database.ts to share SQLite handle across sub-instances
- Refactor src/index.ts to return hooks immediately and initialize services in background
- Use initPromise pattern to defer expensive operations (DB init, graph service, sandbox setup)
- All hooks now await initPromise before executing, allowing POST /session to return quickly
- Database caching uses refcounting to ensure proper lifecycle management

Expected performance improvement:
- Cold bootstrap: ~90ms → ~15ms
- Subsequent sub-instances: ~90ms → ~1ms (reusing cached DB connection)
buildLoopPermissionRuleset was called without excludedTools at 3 of 5
call sites (rotateSession, CLI restart, TUI restart), defeating the
agent tool exclusion feature after the first iteration or restart.

Extract getAgentExcludedTools helper to dedupe the 5 existing
agents.code / agent?.tools?.exclude ?? [] blocks and prevent future
omissions.
Migration 111 made review_findings.scenario nullable, so formatReviewFindings
could render the literal string 'Scenario: null' in the audit prompt.
Fall back to 'N/A' to match the pattern in src/tools/review.ts.
@chriswritescode-dev chriswritescode-dev merged commit 2d71edb into main Apr 21, 2026
1 check passed
@chriswritescode-dev chriswritescode-dev deleted the fix-agent-perms branch April 26, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant