Skip to content

[codex] Refactor conversation session service boundary#77

Merged
roackb2 merged 1 commit into
mainfrom
codex/conversation-session-service-boundary
May 15, 2026
Merged

[codex] Refactor conversation session service boundary#77
roackb2 merged 1 commit into
mainfrom
codex/conversation-session-service-boundary

Conversation

@roackb2
Copy link
Copy Markdown
Owner

@roackb2 roackb2 commented May 14, 2026

Summary

Refactors the conversation session boundary so more TUI session behavior goes through ConversationSessionService instead of direct helper or repository access.

Changes include:

  • adds service-owned operations for persisted messages, reset, continue prompt, drift setting, and session leases
  • changes TUI direct shell, drift, and agent-run controller paths to call the session service for touched session state
  • reshapes createConversationSessionService around an internal FileConversationSessionService class with private repository/config/update helpers
  • adds unit coverage for service-owned persisted message, reset, drift, continue prompt, and lease semantics
  • updates chat-runtime test wiring to use the session service

Notes

This is still a partial TUI boundary slice. Follow-up cleanup is still needed for ordinary-turn and direct-shell compaction paths that continue to own some persisted session semantics in TUI code.

Verification

  • yarn typecheck
  • yarn lint
  • ./node_modules/.bin/vitest run src/__tests__/unit/core/conversation-engine.test.ts src/__tests__/integration/chat/chat-runtime.test.ts

I also previously tried the broader integration script, but it ran unrelated suites and hit local environment failures around git identity and localhost listen permissions.

@roackb2 roackb2 force-pushed the codex/conversation-session-service-boundary branch from ea65671 to de79972 Compare May 15, 2026 06:45
@roackb2 roackb2 marked this pull request as ready for review May 15, 2026 06:49
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: de799723ca

ℹ️ 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 (!persistedSession) {
return undefined;
}
const persistedSession = sessionService.require(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 throwing when persisted session disappears post-turn

After runConversationTurn completes, this now hard-throws if the session record is missing. In multi-client usage, another client can still delete the session during the run (delete does not enforce lease checks), so a completed turn can be misreported as a failed run when require throws and the caller enters the error path. The previous behavior handled this case gracefully by returning early when the session could not be read.

Useful? React with 👍 / 👎.

@roackb2 roackb2 force-pushed the codex/conversation-session-service-boundary branch from de79972 to 5e48012 Compare May 15, 2026 07:01
- Refine TUI session service boundary
- Move TUI display session writes to service
- Move TUI compaction state to session service
- Rename script to verify-tui-behavior
@roackb2 roackb2 force-pushed the codex/conversation-session-service-boundary branch from 5e48012 to 935c652 Compare May 15, 2026 11:01
@roackb2 roackb2 merged commit 71c9b9d 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