FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(session): surface drain failures + check @mention skill permissions by holny · Pull Request #49988 · anomalyco/opencode · GitHub

fix(session): surface drain failures + check @mention skill permissions - #49988

Closed
holny wants to merge 2 commits into
anomalyco:v2from
holny:fix-49740-49891
Closed

holny wants to merge 2 commits into
anomalyco:v2from
holny:fix-49740-49891

Conversation

holny commented Sep 19, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #49740 and closes #49891

Type of change

  • Bug fix

What does this PR do?

Two fixes in the session layer:

1. Drain failure classification (#49740)

terminal() used Cause.hasInterrupts to classify exits, which returns true when the cause contains any interrupt — even if a real failure is also present. Mixed interrupt+failure causes (e.g. inactivity eviction racing with a provider error) were silently classified as "interrupted" and never surfaced as durable failures.

Fixed to hasInterruptsOnly: only pure interruptions are deliberate stops; mixed causes settle as failed with the error envelope via toSessionError.

2. @mention skill permission check (#49891)

Skills attached via @mention in prompts bypassed the permission system entirely (prompt.ts went straight to skillService.get() + prepare()). The skill tool path correctly returns permission.rejected for denied skills, but @mention injected the full body regardless.

Mention-sourced skills now go through the same permission.ask() evaluation: deny → Permission.BlockedError, ask → attachment records the reference without injecting the body, allow → normal injection.

How did you verify your code works?

  • New tests: mixed-cause terminal classification, real SessionExecution.layer + failing runner → durable Execution.Failed, deny+@mention rejection, ask+@mention non-injection
  • test/session 613 pass (1 pre-existing flaky on clean HEAD)
  • bun run typecheck clean (core + server)
  • bun run check 0 errors

A terminal cause that mixes an interruption with a real failure settled
as interrupted, dropping the error from the durable
session.execution.failed event; only pure interruptions are deliberate
stops now. The drain catch path also annotates its log with the same
toSessionError envelope the durable event carries.

Closes anomalyco#49740
Mentioned skills loaded through SessionPrompt.prepare without consulting
the skill permission, so a denied skill's full body entered the model
context via @mention while the skill tool path rejected it. Mentions now
evaluate the same permission: deny rejects the prompt, ask admits the
mention without the prepared body, allow injects as before. The server
prompt endpoint maps the resulting BlockedError to a 400 on the skills
field.

Closes anomalyco#49891
github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 19, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 19, 2026
github-actions Bot closed this Sep 19, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL