You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Session link in GitHub issue/PR footers should be dynamically generated #660
The session link added to GitHub issue and PR bodies is currently hardcoded in skill instructions (sentry.sentry.io, project ID 4510944073809921). This is:
Only valid for Sentry's own internal deployment
Broken for any user with a self-hosted or differently-configured SENTRY_DSN
Using a stale URL path (/traces/?query=) instead of the correct /explore/conversations/{id}/ route
The skill-level template has been removed in #659 as a stop-gap.
Desired behavior
The session link should be dynamically constructed from the runtime's Sentry config (DSN + org slug) and injected into PR/issue bodies by the app — not hardcoded into agent skill instructions.
buildSentryConversationUrl() in packages/junior/src/chat/sentry-links.ts already builds the correct URL from runtime DSN config. The app needs a way to surface this to the github-code and github-issues skills at execution time, either via:
Runtime context injection (e.g. a sentry_session_url field in the turn context passed to skills)
App-level post-processing that appends the footer after the model writes the body
A dedicated tool the model can call to retrieve the session URL
Notes
buildSentryConversationUrl() uses SENTRY_ORG_SLUG env + DSN to build the right URL for any deployment
The correct URL format is explore/conversations/{url-encoded-id}/?project={project_id}
Proposed direction: deterministic provider writes via typed GitHub tools
After talking through the plugin/runtime constraints, the cleanest solution does not look like a generic HTTP body rewrite layer. The better shape is to make deterministic GitHub writes a typed plugin/tool boundary and share the existing credentialed egress path with host/plugin tools.
Problem framing
Today GitHub issue/PR creation is effectively skill-driven shell behavior, usually through gh issue create, gh pr create, gh api, or equivalent HTTP calls from the sandbox. That means the model owns the final body text, and the runtime only owns credential injection.
Prompting the model to include a footer is therefore best-effort, not deterministic. A shell command can also bypass any command-level wrapper by using curl, gh api, GraphQL, or a script.
The enforcement boundary we already have is the egress credential path: GitHub credentials are injected by Junior, not placed directly in the sandbox. So deterministic output needs to move GitHub writes behind a runtime/plugin-owned action boundary.
Proposed architecture
Extract a shared credentialed egress engine from the current sandbox egress proxy.
This shared engine should own the parts that are currently coupled to sandbox proxy handling:
provider resolution
plugin grantForEgress selection
plugin issueCredential
credential context / actor / delegated subject handling
credential header transforms
upstream request execution
plugin onEgressResponse
auth-required and permission-denied normalization
The existing sandbox proxy should become one caller of this engine, not the only place where credentialed provider requests can happen.
Add a host-only plugin egress client.
Plugin runtime/tool code should be able to make provider requests through the same credential path without forcing the request to originate in the sandbox only to get credential interception.
Important: this should be available to plugin runtime code, not directly to the model.
Add typed GitHub write tools.
Start with a model-visible tool such as:
github.createIssue({
repo,
title,
body,
labels,})
The tool would:
validate structured args
construct the deterministic session/footer URL from runtime context, e.g. via buildSentryConversationUrl() or a future generic conversation-link hook
append or merge the footer into the issue body in host/plugin code
call GitHub's basic REST API shape directly through ctx.egress.fetch
return the canonical issue number and URL
This avoids relying on gh issue create flags, temp files, CLI behavior, or HTTP request rewriting.
Deny protected GitHub writes from raw sandbox shell by default.
Since shell can otherwise bypass a typed tool, the egress layer should classify protected GitHub write requests and refuse to inject write credentials for those requests unless they come from an approved runtime-owned path.
Initial protected operations should include at least:
POST /repos/:owner/:repo/issues
PATCH /repos/:owner/:repo/issues/:number when changing body/title/state/labels as policy requires
issue comments if we decide they also need deterministic runtime-owned content
PR creation endpoints when the PR footer case is addressed
relevant GraphQL mutations
Reads can continue to work from shell through normal sandbox egress.
Account for GraphQL bypasses.
GitHub issue creation can be done through GraphQL mutations, not only REST. The existing GitHub plugin already inspects GraphQL request bodies for query/mutation classification under a body-size cap. Protected-write enforcement needs to extend that classification.
Proposed policy:
GraphQL queries: continue through normal read/write grant classification as appropriate.
GraphQL mutations/subscriptions from sandbox shell: treat as protected writes and deny by default unless a future permit mechanism allows them.
Known protected mutations should be explicitly classified where feasible, e.g. createIssue, updateIssue, createPullRequest, updatePullRequest, addComment.
Unknown GraphQL mutations should fail closed from shell, because otherwise they are an easy bypass around typed write tools.
Optional future: JWT write permits for sandbox-originated approved writes.
If we later need a typed tool to intentionally delegate a protected write back into the sandbox, we can add a second short-lived signed permit rather than weakening the default denial.
We discussed JWT-only permits as acceptable if replay within a very short TTL is not a concern. This can wait if host/plugin ctx.egress.fetch covers the typed create path.
Why not generic HTTP rewrite?
A rewrite layer is enforceable, but it is the wrong primary abstraction:
it has to understand REST, GraphQL, gh behavior, body encodings, and retries
it mixes product output policy into the credential proxy
it is harder to reason about than a typed create/update API
it can silently mutate model-created content instead of making runtime ownership explicit
The egress layer should enforce whether a write is allowed. The typed GitHub tool should own the final body.
Open design decisions
These still need to be decided before implementation:
Exact ctx.egress.fetch API shape and where it lives in @sentry/junior-plugin-api.
Whether ctx.egress.fetch should require an explicit provider and operation, or infer provider from URL and use operation only for diagnostics/policy.
How host/plugin egress surfaces auth-required state so the existing OAuth pause/resume flow works outside sandbox bash execution.
Which GitHub write operations are blocked from raw shell immediately versus migrated gradually for compatibility.
Whether issue comments require deterministic footer/content policy, or only issue/PR creation bodies do.
How to treat git smart HTTP push. It is a write, but it likely needs a separate policy from issue/PR API writes.
Whether protected GraphQL mutation denial should be blanket or maintain a narrower mutation allow/deny list.
Whether the deterministic footer should be Sentry-specific via current config, generic via a conversation-link hook, or both.
Whether PR creation should be included in the first slice or follow after issue creation.
Suggested first vertical slice
Extract the shared credentialed egress engine enough to support both sandbox proxy and host/plugin calls.
Add host-only ctx.egress.fetch to plugin tool context.
Implement github.createIssue using GitHub REST directly.
Append the session/conversation footer in the tool before the request is sent.
Update the github-issues skill to use github.createIssue for creation.
Deny raw sandbox GitHub issue creation through REST and GraphQL mutation paths.
Add tests proving:
existing sandbox read egress still works
host/plugin egress uses the existing GitHub credential hooks
github.createIssue appends the footer deterministically
raw shell gh issue create / REST create is denied
GraphQL mutation create paths are denied from shell
This makes deterministic issue bodies runtime-owned, preserves one credential implementation path, and avoids turning the HTTP proxy into a general content rewriter.
I think the best first slice is a behavior-preserving extraction of shared credentialed egress, before adding any new GitHub tool or enforcement policy.
Proposed PR order:
Shared credentialed egress engine
Extract the reusable provider request path from sandbox/egress-proxy.ts.
Keep the sandbox proxy as the only caller.
Preserve current auth-required signals, permission-denied signals, response hooks, logging, and GraphQL grant classification.
No plugin API changes yet.
Host/plugin egress API
Add host-only ctx.egress.fetch to plugin tool context.
Route it through the shared egress engine.
Define how auth-required/permission-denied surfaces from non-shell plugin tools.
Typed GitHub createIssue tool
Add github.createIssue using GitHub REST through ctx.egress.fetch.
Render deterministic session/conversation footer in plugin/runtime code.
Keep raw shell writes unchanged initially if needed to minimize blast radius.
Skill migration
Update github-issues skill to use github.createIssue for creation.
Add model-facing coverage that issue creation chooses the typed tool.
Activity
fix(skills): from sentry session urls in github issues and PRs (#659)
dcramer commentedon Jun 29, 2026
Proposed direction: deterministic provider writes via typed GitHub tools
After talking through the plugin/runtime constraints, the cleanest solution does not look like a generic HTTP body rewrite layer. The better shape is to make deterministic GitHub writes a typed plugin/tool boundary and share the existing credentialed egress path with host/plugin tools.
Problem framing
Today GitHub issue/PR creation is effectively skill-driven shell behavior, usually through
gh issue create,gh pr create,gh api, or equivalent HTTP calls from the sandbox. That means the model owns the final body text, and the runtime only owns credential injection.Prompting the model to include a footer is therefore best-effort, not deterministic. A shell command can also bypass any command-level wrapper by using
curl,gh api, GraphQL, or a script.The enforcement boundary we already have is the egress credential path: GitHub credentials are injected by Junior, not placed directly in the sandbox. So deterministic output needs to move GitHub writes behind a runtime/plugin-owned action boundary.
Proposed architecture
Extract a shared credentialed egress engine from the current sandbox egress proxy.
This shared engine should own the parts that are currently coupled to sandbox proxy handling:
grantForEgressselectionissueCredentialonEgressResponseThe existing sandbox proxy should become one caller of this engine, not the only place where credentialed provider requests can happen.
Add a host-only plugin egress client.
Plugin runtime/tool code should be able to make provider requests through the same credential path without forcing the request to originate in the sandbox only to get credential interception.
Example shape, exact API not finalized:
Important: this should be available to plugin runtime code, not directly to the model.
Add typed GitHub write tools.
Start with a model-visible tool such as:
The tool would:
buildSentryConversationUrl()or a future generic conversation-link hookctx.egress.fetchThis avoids relying on
gh issue createflags, temp files, CLI behavior, or HTTP request rewriting.Deny protected GitHub writes from raw sandbox shell by default.
Since shell can otherwise bypass a typed tool, the egress layer should classify protected GitHub write requests and refuse to inject write credentials for those requests unless they come from an approved runtime-owned path.
Initial protected operations should include at least:
POST /repos/:owner/:repo/issuesPATCH /repos/:owner/:repo/issues/:numberwhen changing body/title/state/labels as policy requiresReads can continue to work from shell through normal sandbox egress.
Account for GraphQL bypasses.
GitHub issue creation can be done through GraphQL mutations, not only REST. The existing GitHub plugin already inspects GraphQL request bodies for query/mutation classification under a body-size cap. Protected-write enforcement needs to extend that classification.
Proposed policy:
createIssue,updateIssue,createPullRequest,updatePullRequest,addComment.Optional future: JWT write permits for sandbox-originated approved writes.
If we later need a typed tool to intentionally delegate a protected write back into the sandbox, we can add a second short-lived signed permit rather than weakening the default denial.
Example claims:
{ "typ": "junior.egress.write.v1", "aud": "junior.egress", "provider": "github", "operation": "github.issue.create", "egress_id": "...", "method": "POST", "host": "api.github.com", "path": "/repos/getsentry/junior/issues", "body_sha256": "...", "iat": 1234567800, "exp": 1234567860 }We discussed JWT-only permits as acceptable if replay within a very short TTL is not a concern. This can wait if host/plugin
ctx.egress.fetchcovers the typed create path.Why not generic HTTP rewrite?
A rewrite layer is enforceable, but it is the wrong primary abstraction:
ghbehavior, body encodings, and retriesThe egress layer should enforce whether a write is allowed. The typed GitHub tool should own the final body.
Open design decisions
These still need to be decided before implementation:
ctx.egress.fetchAPI shape and where it lives in@sentry/junior-plugin-api.ctx.egress.fetchshould require an explicitproviderandoperation, or infer provider from URL and use operation only for diagnostics/policy.Suggested first vertical slice
ctx.egress.fetchto plugin tool context.github.createIssueusing GitHub REST directly.github-issuesskill to usegithub.createIssuefor creation.github.createIssueappends the footer deterministicallygh issue create/ REST create is deniedThis makes deterministic issue bodies runtime-owned, preserves one credential implementation path, and avoids turning the HTTP proxy into a general content rewriter.
dcramer commentedon Jun 29, 2026
Suggested PR slicing
I think the best first slice is a behavior-preserving extraction of shared credentialed egress, before adding any new GitHub tool or enforcement policy.
Proposed PR order:
Shared credentialed egress engine
sandbox/egress-proxy.ts.Host/plugin egress API
ctx.egress.fetchto plugin tool context.Typed GitHub
createIssuetoolgithub.createIssueusing GitHub REST throughctx.egress.fetch.Skill migration
github-issuesskill to usegithub.createIssuefor creation.Protected write enforcement
This avoids introducing blocking policy before the replacement path exists, and gives reviewers one concern per PR.
ref(sandbox): Group egress modules
ref(config): Share development env defaults
docs(sandbox): Explain egress module boundaries
ref(sandbox): Simplify egress forwarding flow
ref(sandbox): Simplify egress forwarding flow
fix(dev): Align heartbeat fallback secret
ref(sandbox): Extract credentialed egress execution (#675)
feat(egress): Add plugin egress fetch context
fix(egress): Tighten plugin egress contracts
test(egress): Cover plugin tool host egress
14 remaining items
fix(github): Use Sentry session link as issue footer
fix(github): Align issue tool packaging
fix(github): Run plugin tests in CI
feat(github): Add typed issue creation tool (#687)
fix(github): Fail closed on uninspectable issue egress
test(github): Remove invalid createIssue shorthand case
fix(github): Deny raw issue creation egress (#689)
feat(github): Add typed pull request creation
feat(github): Add typed pull request creation
feat(github): Add typed pull request creation
feat(github): Add typed pull request creation
test(plugins): Update prefixed tool expectations
feat(github): Add typed pull request creation (#690)
dcramer commentedon Jun 30, 2026
Fixed by the typed GitHub write path work: host/plugin credentialed egress (#685), typed issue creation with runtime-owned session footer (#687), raw issue creation denial (#689), and typed PR creation with runtime-owned session footer (#690).