feat: add headless conversation agent#254
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0359c3b90
ℹ️ 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".
| const credential = ConversationAgentRuntimeService.preflightCredentials({ | ||
| apiKey: options.apiKey, | ||
| credentialStorePath: options.credentialStorePath, | ||
| defaults, | ||
| preferApiKey: options.preferApiKey, | ||
| preflight: options.credentialPreflight, | ||
| }); |
There was a problem hiding this comment.
Preflight against the resumed session model
When a stable session already exists with a different model/provider than the current defaults, this constructor validates credentials for defaults.model before ensureSession() has read the persisted session, while the actual turn later resolves the runnable model from session.model. In that case a reusable session can be rejected because the default provider is missing credentials, or pass preflight and then fail during send() because the persisted provider is missing; perform preflight after ensure/read using the effective session model.
Useful? React with 👍 / 👎.
Stack
codex/conversation-persistence-capability)mainSummary
ConversationAgentServiceas the smallest structured, in-process conversation entrypointengine.sessions.ensure({ id })with create-or-read semantics across competing service instancessessionCreatedBoundary
The service is deliberately headless and process-local. It does not own HTTP, authentication, tenant mapping, browser-safe projection, canonical product transactions, or durable in-flight execution. Returned turn data is trusted host data and must be projected before crossing an untrusted network boundary.
The default stable ID is
session-1. Hosted/multi-user code must supply a trusted product-derived ID and scoped repositories. Ensure creation fields never overwrite an existing session.Verification
yarn test— 121 unit files / 715 tests; 34 integration files / 310 testsyarn typecheckyarn lintyarn buildConversationAgentService: completed with 8 captured activitiessessionCreated: false, reached 2 persisted turns, and recalled the first-turn phrase