fix-agent-perms → main#5
Merged
chriswritescode-dev merged 4 commits intomainfrom Apr 21, 2026
Merged
Conversation
Owner
chriswritescode-dev
commented
Apr 21, 2026
- 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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.