Skip to content

test(agents): pin the fail-closed launch contract without a session manager - #2681

Merged
barbatdev merged 1 commit into
mainfrom
fix/1709-unguarded-session-manager
Oct 30, 2026
Merged

barbatdev merged 1 commit into
mainfrom
fix/1709-unguarded-session-manager

Conversation

@barbatdev

@barbatdev barbatdev commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1709 by pinning the current, deliberate behavior instead of changing it.

The issue reported that a context without a sessionManager made the launch seam crash with an unguarded ctx.sessionManager.getSessionId() read instead of treating the session as unbound. On current main that defect no longer exists, and the desired outcome deliberately changed shape:

What was actually missing was coverage, so this PR adds one test: a subagent_run launch with no session manager must reject with the session-profile authority message. Test-only change, no production code.

Verification

  • Mutation check: reverting the authority reader's unobservable-manager swallow turns the new test red with the exact historical TypeError (Cannot read properties of undefined (reading 'getSessionId')), confirming the pin guards the reported defect.
  • Full tests/gentle-agents.test.ts: 276 pass, 0 fail.

Risk: none

Summary by CodeRabbit

  • Tests
    • Added a regression test verifying that launching a subagent is rejected when session profile authority is unavailable.

…anager

gentle-shell#1709 asked the launch seam to treat a missing session
manager as an unbound session. The #1991 fail-closed contract instead
blocks the launch with the session-profile authority message, and the
authority reader already swallows an unobservable manager instead of
throwing a TypeError. Pin that behavior with a direct subagent_run
test so the clean failure cannot regress into a crash.
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: fabd8024-02cd-4b4f-8830-f7d3f55355c7
Commits

Reviewing files that changed from the base of the PR and between f2427a9 and 1fedf31.

Files selected for processing: 1
  • tests/gentle-agents.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Adds a regression test for subagent_run. The test removes sessionManager from the launch context and checks for the Session profile authority unavailable error.

Changes: Subagent launch regression coverage

Layer / File(s) Summary
Missing session manager launch check
tests/gentle-agents.test.ts
Adds a test that configures a pinned profile, removes sessionManager, and expects subagent_run to reject with the specified authority error.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Possibly related PRs

Suggested labels: type:bug

Suggested reviewers: alan-thegentleman

Merge Risk: Minimal · up to 1fedf

This test-only change is mergeable; it adds coverage for managerless subagent launches.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Linked Issues check Warning Issue #1709 (open, direct) requires that a missing sessionManager resolves to an unbound session and that the launch seam guards the read. At head, lib/session-profile-authority.ts readSessionProfileA… Choose one. (a) Change the subagent_run and subagent_continue launch path so an absent sessionManager resolves to an unbound session, as #1709 requests. Make the new test assert that outcome. (b) Have the owner of #1709 record in the issue …
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the added regression test for the fail-closed launch behavior when no session manager is available.
Out of Scope Changes check Passed The PR summary describes one added regression test in tests/gentle-agents.test.ts (+20/-0). The test asserts that subagent_run rejects a launch when the context has no session manager, with the messag…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Out of Scope Changes check

Explanation

The PR summary describes one added regression test in tests/gentle-agents.test.ts (+20/-0). The test asserts that subagent_run rejects a launch when the context has no session manager, with the message 'Session profile authority unavailable'. It relates directly to the launch-authority behavior named in #1709. The PR reports no production code changes. The test diff could not be read because the changed blobs are missing from the checkout. This verdict therefore rests on the PR summary and description.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Full details: Linked Issues check

Explanation

Issue #1709 (open, direct) requires that a missing sessionManager resolves to an unbound session and that the launch seam guards the read. At head, lib/session-profile-authority.ts readSessionProfileAuthority wraps the manager access in try/catch. With no manager, the TypeError is caught and the function returns { available: false }. requireSessionProfileAuthority then throws 'Session profile authority unavailable; affected launches are blocked...'. The launch is blocked. It is not treated as an unbound session. The raw TypeError symptom is gone, but the expected outcome in #1709 is not met. The PR description says #1991 superseded the unbound-session outcome. No #1991 evidence is in the supplied material. #1709 remains open with its expected outcome unchanged. The added test pins the blocked behavior, so it does not implement the #1709 requirement. I did not inspect the launch call sites in extensions/gentle-agents.ts beyond the first 16000 bytes. The call-order claim rests on the PR description.

Resolution

Choose one. (a) Change the subagent_run and subagent_continue launch path so an absent sessionManager resolves to an unbound session, as #1709 requests. Make the new test assert that outcome. (b) Have the owner of #1709 record in the issue that #1991 replaced the unbound-session requirement, with a link to the #1991 evidence. Then re-assess against the updated requirement. Do not close #1709 from this PR until one of these is done.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@barbatdev
barbatdev merged commit 3ee1d90 into main Oct 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(agents): unguarded sessionManager read makes launches crash without a session manager

1 participant