Repository navigation
Say why a policy or hook stop ended the turn - #1059
Conversation
A configured stop carries its rule on the event the panel reads, and the snapshot restores that rule. The audit records the turn as running before the decision and stopped or closed after. A hook that ends the turn or closes the session names the tool and the hook's reason. A continue stays quiet. Co-authored-by: Saurav <saurav.panthee@gmail.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
An in-process restart can deliver source_closed before the socket dies. The follower treated that as fatal, left the view frozen, and then accepted a subscription past the connection limit because the server had released the slot. Subscribe again, as the protocol already says to. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7ca42a662
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
An end-turn that arrives after the provider has already settled leaves the session open. The warning was written before that check, so it claimed the hook had stopped a turn the provider finished on its own. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c113a6d105
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A provider that has already settled is recorded as continue, so the panel does not say the hook stopped it. An end-turn cancellation that is followed by any other finish stays off the turn until the execution is cancelled. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afa3dcf7a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ReviewDeclineId and PermissionId are different identities. A local notice now says whether it is the review or the hook, so the same decimal can name both and the hook sentence stays. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
The client typecheck rejected a notice kind on a part whose type was inferred without that field. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1423b24e91
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A permission id and a decline id are different identities. Admission checks each inside its own type, so a restored history can keep a hook notice beside a review notice that uses the same decimal. A deadline settlement uses its own notice kind, so that sentence stays beside the decline. Co-authored-by: Saurav <saurav.panthee@gmail.com>
The decline audit is written before session cleanup is confirmed. Its after field is closing. The confirmed transition stays on the session_closed record. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
The restoration regression still required those identities to collide. A custom adapter may assign the same decimal to both, and one permission requested twice is still rejected. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 555eb65f89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The decline event requests the close. The panel sentence now says the session is closing. It does not say the session has closed. The confirmed transition stays on session_closed. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Both sides already resume a stress subscription when its change source closes. The comments keep that protocol rule and the reason a fatal source_closed freezes the view. Co-authored-by: Saurav <saurav.panthee@gmail.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Before: A rule or hook that stops a turn records the decision, and the conversation goes quiet.
After: The turn says it was stopped, names the rule or the hook and the tool, and the audit keeps that local decision apart from whatever the provider reports later.
Closes #136
#130 stays open. #989 (notify the phone while a permission review waits) is still open and is part of that tracker.
Background
A binding can be configured to end the turn or close the session when it refuses a tool review. A permission-review hook can return the same two outcomes. The audit record already names the rule. The panel reads execution events, not the audit sink, and those events dropped the rule. A hook stop cancelled the review and finished the turn with no notice.
The problem
You ask the agent to run a tool. A rule or a hook refuses and stops the turn. The turn ends, and nothing on screen says why.
The solution
The declined-review event carries the same rule as the audit record. A stop has a rule and a continue has none; both the record and the event use that one check. The snapshot stores the rule and restores it through the same constructors. A saved stop without a rule, or a continue with one, is corrupt.
A hook stop is not relabelled as a rule. When the cancellation is an end-turn or a close-session hook refusal, and the review id is a notice id, the panel names the tool and quotes the hook's reason. A continue stays quiet. A declined-review notice, a hook notice, and a deadline notice are different decisions. The same decimal may name each of them. Admission checks a permission id only against other permission ids, and a decline id only against other decline ids. The wire says which decision the notice is, so no sentence replaces another.
The audit says the turn was running before the decision. After a continue it is still running. After an end-turn it is stopped, because that execution has already finished locally. After a close-session it is closing: the record is the requested close, and cleanup can still be unconfirmed. The panel sentence for that configured close says the session is closing, not that it has closed. The confirmed session transition is the separate session_closed record, whose after is closed. A provider result that arrives later stays a separate late-result record.
The decision is ADR 136. Feature commit
86108c06f. The stress follower follows a subscription again when the change source closes (a7ca42a66). The hook-stop log is written only after the stop is applied (c113a6d10). A hook end-turn sentence is shown only once that execution is cancelled (afa3dcf7a). A hook notice stays when a review notice already uses the same decimal (77c815321). Admission keeps that shared decimal, including through custom storage (3e4144943,555eb65f8), and a deadline settlement is its own notice kind. A close-session decline recordsclosing, and the panel says the session is closing (8b0200eca,1c09590a2).How we checked it
runningand afterstopped. A close-session decline says afterclosing. A continue staysrunning. The confirmed close remainssession_closedwith afterclosed. The configured close sentence says the session is closing.cargo clippy -p nessa-sdk -p nessa-protocol -p nessa-server --all-targets -- -D warningsis clean on8b0200eca. The projection tests for the hook sentence, the shared decimal through admission, the deadline kind, and the wire kind pass. The client view check accepts one review notice, one hook notice, and one deadline notice with the same decimal, and rejects a repeated kind. The custom-storage restoration test passes on555eb65f8. The configured close sentence test passes on1c09590a2.The live gateway still installs a continue refusal, so no conversation can be driven into this notice from the product. The projection tests are the panel contract. No scripted end-to-end run can produce this sentence until a product setting selects a stopping refusal.
Tradeoffs and follow-ups
The panel sentence is computed from the event, so an audit failure cannot hide the reason. A second event type for "policy stop" was not added, because it would be a second owner of the same refusal. A hook is not stored as a rule.
Left for later: a product setting that selects a stopping refusal, and #989.
Rollout
Nothing special. Nessa is alpha and this snapshot field is new; a continue saved without a rule still restores.