test(agent-core-v2): add lifecycle create stub to sessionLegacy status test - #1691
Conversation
…s test SessionLegacyService.status() now resolves the main agent through ensureMainAgent() -> IAgentLifecycleService.create() (since d158e0a), but the scenario's hand-rolled lifecycle stub only implemented whenReady, so the test errored with 'create is not a function' before any assertion ran. Return the existing main agent from create, matching the real service's create-or-get contract for explicit ids.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76ba73e05f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // create is create-or-get for explicit ids: this session's main agent | ||
| // already exists, so return it as-is (same as whenReady). |
There was a problem hiding this comment.
Remove the inline statement comment
packages/agent-core-v2/AGENTS.md requires comments in this package to live only in the top-of-file /** */ block and says to never place them beside statements; this new explanation is inside the agents object. Move the rationale into the existing file header or drop it so the test stays within the package's documented convention.
Useful? React with 👍 / 👎.
Related Issue
None — fixes a red
main(CItest (4)), problem explained below.Problem
Since #1625 (
d158e0a7a),main's CI fails inagent-core-v2 test/app/sessionLegacy/sessionLegacy.test.ts:#1625 changed
SessionLegacyService.status()to resolve the main agent throughensureMainAgent(), which callsIAgentLifecycleService.create(). The test's hand-rolled lifecycle stub predates that path and only implementswhenReady, so the scenario errors before any assertion runs.main's own CI (test (4)shard) has been red since that merge, and every open PR inherits the failure.What changed
Test-only: add
createto the stub, returning the scenario's existing main agent. This matches the real service's create-or-get contract for explicit ids (createjoins an in-flight creation and returns an already-created main agent as-is), which is exactly what this session models — a persisted session whose main agent already exists. No implementation code touched; the new status path is the intended behavior.Checklist
agent-core-v2suite passes locally).gen-changesetsskill, or this PR needs no changeset (test-only change).gen-docsskill, or this PR needs no doc update.