#16964: test: add regression tests for sub-agent session path resolution
stale
size: XS
Cluster:
Session Management Enhancements
## Summary
- Adds regression tests for `resolveSessionFilePath` covering sub-agent scenarios where `agentId` is required
- Verifies main agent and sub-agent paths are distinct and correctly resolved
- The underlying code fix was already applied; these tests prevent regressions
Relates to #16826, #16278
## Test plan
- [x] Tests verify main vs sub-agent paths differ
- [x] Tests verify agentId is properly incorporated into resolved paths
- [x] Full test suite passes (`pnpm test:fast`, `pnpm check`)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added four regression tests for `resolveSessionFilePath` covering sub-agent session path resolution scenarios. Tests verify that main agent sessions default to `agents/main/sessions/` while sub-agent sessions correctly resolve to `agents/{agentId}/sessions/` when `agentId` is provided. The underlying fix was already applied in cab0abf5; these tests prevent future regressions.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no risk
- Pure test addition covering regression scenarios. Tests are well-structured, follow existing patterns, and correctly verify the distinction between main and sub-agent session path resolution. No production code changes.
- No files require special attention
<sub>Last reviewed commit: 52989f8</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#14734: test(agents): guard against stale allowAgents in existing sessions
by davidahmann · 2026-02-12
84.2%
#15793: fix(sessions): gracefully handle stale cross-agent session file paths
by lxcong · 2026-02-13
80.6%
#15792: fix: pass agentId to resolveSessionFilePath in additional call sites
by MisterGuy420 · 2026-02-13
79.1%
#15982: fix: pass agentId to resolveSessionFilePath in reply flow (NX-003)
by automagik-genie · 2026-02-14
78.4%
#22917: fix: Use agent's configured workspace when spawned as subagent
by jriff · 2026-02-21
78.3%
#17788: fix: correct config path in sessions_spawn error hint (v2)
by Limitless2023 · 2026-02-16
78.1%
#10197: fix: add missing allowAgents to agent defaults subagents schema
by Yida-Dev · 2026-02-06
77.4%
#8471: fix(subagent): add defensive checks for undefined string fields
by adam-smeth · 2026-02-04
77.0%
#16249: fix(sessions): allow cross-agent session paths in multi-agent bindings
by 0xbrak · 2026-02-14
76.9%
#7584: Tests: align subagent announce wait expectations
by justinhuangcode · 2026-02-03
76.9%