Repository navigation
fix(proxy): apply a consent refusal before the command that stores it returns - #969
Merged
BolotnyaBoss merged 9 commits intoDec 4, 2026
Merged
Conversation
The proxy tick and the hold release both built the forward lock's path themselves. acquireForwardLock names it once, in the current spool scope, so a third caller locks the same file. No behaviour change. Task 1 of epmcdme-18353-consent-refusal-before-tick. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
refuseProject stops and deletes the held governed sessions of one project for the command that stores the "no". It is given the project instead of reading the answers file, writes the stop outside every lock, deletes the spool files only under the session's forward lock with one deadline for the whole walk, and returns one outcome per session: deleted, files_left or not_stopped. A listing that fails makes the result undefined. The selection of the sessions is shared with the daemon's pass: the two walks differ only in how they list and what they do with a session. applyRefusals behaves as before. Task 2 of epmcdme-18353-consent-refusal-before-tick. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…turns With a live daemon of the CLI's own version, `consent revoke` and a "no" at the consent question of `proxy connect` only recorded the answer and left the held sessions to the daemon's next tick. A grant inside that tick replaced the answer, the sessions got no stop, and `resend` published them. refuseConsent now stores the "no" and runs refuseProject itself, whatever daemon runs: no daemon lock is taken and the daemon's state is read only for the older-daemon hint. The output follows the walk: - a session stopped with its files left is named, with what removes them; the command still succeeds - a session that could not be stopped, or a walk that did not run to its end, asks for a second revoke before any grant; `consent revoke` exits non-zero without its closing lines and the connect consent step fails The "no" stays recorded in every case. Task 3 of epmcdme-18353-consent-refusal-before-tick. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…urns PROXY-AND-ANALYTICS.md and COMMANDS.md describe what `consent revoke` does to the sessions the proxy already holds for consent: they are stopped and their held data is deleted before the command returns; a session begun since the proxy's last pass is not stopped by it; a busy session is stopped and its data goes on the proxy's next pass or within 24 hours; a session that could not be stopped makes the command exit non-zero and ask for a second run before any grant. Task 4 of epmcdme-18353-consent-refusal-before-tick. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
A held session or batch whose record cannot be read, and a file the delete could not remove, are part of the walk's answer: the command names them, and `consent revoke` fails instead of printing its success line. A walk that cannot name the destination segment is a failed walk. `proxy connect` prints no grant hint after a refusal that left a session not stopped, and the line about data left for a busy session names no time bound. `deleteSession` answers whether every file is gone. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
The technical analysis, the spec and the plan of the change, both complexity assessments, the gate run, the review record and the gate decisions. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…e run The run's planning files leave the change; the review record and the gate decisions stay, as in the task folders of earlier changes. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
BolotnyaBoss
reviewed
Dec 4, 2026
BolotnyaBoss
approved these changes
Dec 4, 2026
added 2 commits
December 4, 2026 21:31
…fusal The proxy daemon's replay shares no lock with the command and removes a batch it has consumed. A batch listed and then missing at the read was reported as unread, so `consent revoke` printed "not stopped yet" and failed though nothing was left to refuse. Such a batch is skipped now; any other read or parse error is still reported.
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.
Summary
Fixes EPMCDME-18353. With a proxy daemon of the same version running,
codemie proxy analytics consent revokeonly stored the "no" and left stopping the held sessions to the daemon's next tick. The answers file keeps one answer per project, so aconsent grantbefore that tick erased the "no": the refusal was never applied, andresendreleased the session that had been held at the revoke.The command that stores a "no" now applies it itself, before it returns, whatever daemon runs.
Changes
consent revokeand a "no" at the consent question ofproxy connectstop the held personal-subscription sessions of the project and delete their held data before the command returns. Each session gets its stop marker first, then its files are deleted under the session's forward lock — the lock the daemon's tick andresendalready take. A session the daemon is busy with is stopped at once and its files are left for the daemon.consent revokeexits non-zero, with the "no" still stored. Files that could not be deleted are reported as left.proxy connectprints no grant hint after a refusal that left a session not stopped.consent-refusal.ts, with the selection it shares with the daemon's pass. The daemon's own refusal pass on the tick stays as the second line.deleteSessionanswers whether every file is gone; the forward lock is taken through one helper.docs/PROXY-AND-ANALYTICS.mdanddocs/COMMANDS.mdsay what a revoke does before it returns.We decided to leave one case as a known limit: a session the daemon has not classified yet at the moment of the revoke is not stopped by it, and stays releasable after a grant until the daemon's second refusal pass (up to two tick periods, four minutes by default). Closing it needs the time of the refusal kept in the answers file, which this change does not touch.
A CLI released before this change, beside a daemon that has it, still only stores the answer.
#965 changes the same helper in
connect-consent.ts: whichever lands second takes the other in — its daemon replacement goes before this walk.Impact
revoke, thengrant --yesandresend --yesbefore the daemon's tickresendand sentconsent_revokedbeforerevokereturns;resendreleases nothingrevokeprinted successrevokenames it, prints no success line and exits non-zeroChecked by hand on this branch's build: the three commands of the ticket run one after another inside one daemon tick, with a real signed-in Claude Code session held for consent, in an isolated home against a stand-in backend.
Lint, type check, build and the
unitandclitest projects pass.Checklist