[codex] Clarify control-plane session boundary#79
Conversation
- Rename web services to controllers for clarity - Remove control-plane controller wrapper exports - Split chat session controller classes - Move control-plane turns behind engine service - Route ask sessions through conversation engine
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64a4c66d45
ℹ️ 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".
| if (options.sessionId) { | ||
| const session = readChatSession(options.sessionStoragePath, options.sessionId, options.apiKeyPresent); | ||
| if (!session) { | ||
| throw new Error(`Chat session not found: ${options.sessionId}`); | ||
| } | ||
| return session; | ||
| return options.engine.sessions.require(options.sessionId); |
There was a problem hiding this comment.
Avoid creating fallback session for invalid --session-id
Using engine.sessions.require(...) here causes a side effect when the catalog is empty: require reads through loadSessions(), which materializes and saves the fallback session-1 before throwing "Chat session not found" for the requested ID. In practice, a typo like --session-id bad now mutates .heddle/chat-sessions.catalog.json and leaves a persisted session behind, which also changes later --latest behavior from "no sessions" to selecting that synthetic session.
Useful? React with 👍 / 👎.
Summary
services/tocontrollers/so interface-specific daemon/web logic is distinct from core domain services.createConversationEngine(...).sessionsandcreateConversationEngine(...).turns.runAgentLoop, and older TUI direct turn execution.--lateston an empty catalog and keeps TUI behavior verification intact.Why
The intended boundary is host/controller code -> core conversation engine services -> storage/runtime helpers. This PR trims older direct repository/turn execution paths and makes future agents see one clearer direction instead of multiple competing implementation styles.
Validation
yarn typecheckyarn lintyarn -s vitest run src/__tests__/unit/core/conversation-engine.test.tsyarn -s vitest run src/__tests__/integration/tui/ask-cli.test.tsyarn verify:tui-behaviorNote: the daemon ask tests require local
127.0.0.1binding; I reran the ask CLI integration outside the sandbox after the sandbox rejected local listen withEPERM.