permission prompts: route left registered when a request is not held; check CliSession's abandon path
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, node.js
Research direction
Start in packages/server/src/ws-permissions.js and trace handlePermissionRequest, registerPermissionRoute, and cleanup() to identify everything the throw path must release; add a test proving route teardown occurs after a broadcast failure. Then inspect CliSession._onLastPermissionResolved and packages/server/tests/permission-deadline-chain.test.js, especially the production release path and the PTY-gone case. Done when both timer behavior and the teardown comment match the acceptance criteria.
Written by the indexing model from the issue text.
Description
Context
Filed from: #9091
Identified during the fix-delta review of PR #9091 (refs #8529). None of these changes what that PR delivers.
Description
Three small follow-ups around what happens to a hook-routed permission prompt that is abandoned or never held.
-
A request the handler fails to hold leaves its route registered. In
packages/server/src/ws-permissions.js,handlePermissionRequestregisters the permission route (registerPermissionRoute, orpermissionSessionMap.set) before it broadcasts the prompt. If a later step throws, the catch answers 500 and, since #9091, tells the owning session the prompt ended, but it does not calltearDownRoute(requestId)the waycleanup()does. The map entry and the permission-induced subscription then outlive the request. The route leak predates #9091. No resend can resurrect the prompt, becauseresendPendingPermissionswalkspendingPermissions. -
Check whether
CliSessionre-arms its timers while abandoning prompts.BaseSession._expirePendingPermissionsemitspermission_expiredbefore it clears the id set, and the daemon's release comes back synchronously throughnotifyPermissionResolved.ClaudeTuiSessionnow guards against that re-arm (#9091).CliSession._onLastPermissionResolvedhas the same shape (if (this._isBusy) this._armResultTimeout()). Whether its callers clear the timers afterwards on every path has not been checked. -
Say which teardown case exercises the abandon latch. In
packages/server/tests/permission-deadline-chain.test.js, of the five "with a prompt pending abandons it" cases only the PTY-gone case fails when the latch is removed; the other four pass because their teardown clears the timers afterwards. A comment should say so, so the set is not read as five proofs of the latch.
Original Review Comment
The new catch tells the session the prompt ended, but it leaves the route that the same path registered (
registerPermissionRoute, which writes thepermissionSessionMapentry and the permission-induced subscription refcount). That route now outlives a request answered 500, so the session's view and the route map disagree. This leak is older than the delta; the delta made the cleanup partial rather than adding it.
Acceptance Criteria
- The throw path releases everything
cleanup()releases, with a test that fails when the route teardown is removed. -
CliSessionis shown, by a test wired to the production release path, either not to re-arm timers while abandoning prompts or to clear them on every teardown path; fixed if it does not. - The teardown tests' comment names the case that depends on the latch.
- Dominant language
- JavaScript
- Stars
- 7
- Forks
- 1
- Avg merge
- 2h 3m
- Merged PRs (30d)
- 333
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from blamechris/chroxy
-
from-review tech-debt testing
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
blamechris/chroxy#9520 ·
Maintainers usually reply within 1 day
-
priority: low server
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
blamechris/chroxy#9340 ·
Maintainers usually reply within 1 day
-
documentation from-review
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
blamechris/chroxy#9237 ·
Maintainers usually reply within 1 day
-
agent-control client: notify() docstring should say the outbound gate applies only in principal modeOpenenhancement from-review
Difficulty 1/5 Under an hour Newbie friendliness 80/100
blamechris/chroxy#9227 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blamechris/chroxy#9108 ·
Maintainers usually reply within 1 day
All issues in blamechris/chroxy
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Use one constant for the 10,000-character input limitPossibly taken @NginxL claimed this today. Opengood first issue refactor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aniru-dh21/snap-validate#51 ·
Maintainers usually reply within 1 day
-
Documentation pleaseOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area/host bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Fei2411/DeepSeek-Bot#3190 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days