Skip to content

[codex] Clarify control-plane session boundary#79

Merged
roackb2 merged 2 commits into
mainfrom
codex/p0-control-plane-session-boundary
May 15, 2026
Merged

[codex] Clarify control-plane session boundary#79
roackb2 merged 2 commits into
mainfrom
codex/p0-control-plane-session-boundary

Conversation

@roackb2
Copy link
Copy Markdown
Owner

@roackb2 roackb2 commented May 15, 2026

Summary

  • Renames the server control-plane surface from services/ to controllers/ so interface-specific daemon/web logic is distinct from core domain services.
  • Routes control-plane and ask-mode session-backed create/read/latest/submit flows through createConversationEngine(...).sessions and createConversationEngine(...).turns.
  • Converts control-plane controllers and core conversation session/turn services toward direct class-based construction, removing thin wrapper factories and one-line re-export functions.
  • Adds boundary comments for remaining old shapes: fake E2E session mutation, stateless ask direct runAgentLoop, and older TUI direct turn execution.
  • Adds regression coverage for ask --latest on 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 typecheck
  • yarn lint
  • yarn -s vitest run src/__tests__/unit/core/conversation-engine.test.ts
  • yarn -s vitest run src/__tests__/integration/tui/ask-cli.test.ts
  • yarn verify:tui-behavior

Note: the daemon ask tests require local 127.0.0.1 binding; I reran the ask CLI integration outside the sandbox after the sandbox rejected local listen with EPERM.

roackb2 added 2 commits May 15, 2026 19:04
- 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
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/cli/ask.ts
Comment on lines 335 to +336
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@roackb2 roackb2 merged commit 9782e96 into main May 15, 2026
4 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.

1 participant