Repository navigation
fix(agents): declare visible-session constraints upfront in sessions_spawn - #111502
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9102640d2
ℹ️ 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".
| error: | ||
| "Visible sessions unavailable with inherited tool restrictions. This session was spawned with a tool allow/denylist; visible sessions require an unrestricted session.", |
There was a problem hiding this comment.
Correct the restriction source in the error
When a top-level session has an effective policy such as tools.deny: ["exec"], this branch also runs even though the session was never spawned with a tool list: src/agents/agent-tools.ts:826-833 seeds these arrays from effective profile/owner policy, and src/agents/agent-tools.ts:1150-1153 similarly captures configured allow policies. The new error and matching docs therefore misdiagnose a configurable policy restriction as immutable spawn-time state, which can send users looking for a nonexistent parent spawn instead of the applicable tool configuration; describe this generically as an effective allow/deny restriction or preserve its provenance.
Useful? React with 👍 / 👎.
| ? '`mode="run"` one-shot; `mode="session"` persistent/thread-bound only on supporting requester channel.' | ||
| : '`mode="run"` one-shot background.', | ||
| '`visible=true`: persistent dashboard session; subagent only; omit `mode` (no `mode="run"`), `thread`, `thinking`, `lightContext`, `attachments`, `attachAs`; inherited tool allow/denylist blocks it at spawn with no config override.', | ||
| "Session listing/addressing obeys `tools.sessions.visibility` (`tree` default: current + own spawn subtree).", |
There was a problem hiding this comment.
Avoid advertising recursive tree visibility
When a child spawns a grandchild, the root cannot list or address that grandchild under the default visibility: src/plugin-sdk/session-visibility.ts:301-306 recognizes only rows whose ownership fields equal the current requester, and direct-key lookup filters by that exact requester at src/plugin-sdk/session-visibility.ts:60-67. The grandchild points to the child, so it is rejected by the tree guard rather than belonging to the root's full subtree. This new model-facing claim can therefore cause failed nested-session targeting; say “directly spawned sessions” unless visibility is made recursively transitive.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 2:31 PM ET / 18:31 UTC. Summary PR surface: Source +32, Tests +53, Docs +1. Total +86 across 11 files. Reproducibility: yes. from source: invoke Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the existing visible-session admission rules, land the clearer schema and aggregated diagnostics only after a redacted live tool-call transcript confirms the stated first-call behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: invoke Is this the best way to solve the issue? Yes, provisionally: declaring the existing constraints in the model-visible schema and aggregating same-stage input violations is narrower and more maintainable than changing admission policy or adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 40d31f34813c. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +32, Tests +53, Docs +1. Total +86 across 11 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Merged via squash.
|
What Problem This Solves
An agent on a shared gateway asked to create sidebar sessions burned 8 failed
sessions_spawncalls discovering constraints one rejection at a time:visible:trueunsupported on its runtime path,mode:"run"invalid for persistent visible sessions,lightContext/attachments unsupported — and only then the real blocker, "Visible sessions unavailable with inherited tool restrictions." Every constraint was enforced correctly but communicated one failure at a time, and none of it was in the tool schema the model reads before calling.Why This Change Was Made
Communication-only fix — nothing about what is allowed changes:
sessions_spawntool description and per-parameter docs now declare the visible-session contract upfront: persistent (nomode:"run"), unsupported params enumerated, the inherited allow/denylist rule (spawn-time, no config override), andtools.sessions.visibilityscoping (defaulttree).ToolInputErrornaming every violation (both visible-only params used withoutvisible:trueand vice versa); genuinely sequential gates (depth, agent-id) stay sequential.forbiddennow carries an actionable hint so agents stop retrying parameter shapes against a permission wall.docs/tools/subagents.mdaligned; prompt snapshot fixtures regenerated (pnpm prompt:snapshots:checkgreen).User Impact
Agents (and the humans watching them) get one clear error instead of a trial-and-error spiral; sidebar-session requests either work or fail with the real reason on the first call.
Evidence
pnpm prompt:snapshots:check7 files current (regenerated; Linux CI is canonical truth).Redacted current-head runtime tool-call proof
Directly invoking the production
sessions_spawntool implementation atc9102640d2580b7f6a438ac9ac4cc2d5bc51cb92produced:Inputs were limited to a redacted task plus the listed invalid parameters; the inherited-restriction invocation used a redacted denylist entry. No session was created in either case.