Phase 2-C: Backend Codex CLI / OpenAI GPT Session Source #43
Labels
No Label
admin
agent-api
api
api-client
audit
backend
boards
cost-accounting
database
design
forgejo
frontend
issues
metrics
mutation
navigation
optional
phase:1
phase:2
phase:3
phase:4
phase:5
phase:6
polish
priority:high
priority:low
priority:medium
service
sync
usage-accuracy
validation
webhooks
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Pipeline#43
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source plan:
/home/kaspa/.claude/plans/with-our-backend-created-precious-owl.mdFeature context: Feature 2: Tool Use Analytics
Scope
Phase 2-C — Backend: Codex CLI / OpenAI GPT Session Source
Summary
Add a Codex/OpenAI session source that mirrors the Claude Code backend contract as closely as possible: list local Codex CLI sessions, read a session conversation, and aggregate tool analytics for Codex/GPT activity.
Problem
The Claude Code UI now exposes sessions, messages, and tool analytics, but the data model is still Claude-specific. Users who use Codex CLI or OpenAI/GPT-backed agent workflows need the same operational visibility without a second, unrelated experience.
Affected area
Affected files
backend/app/services/codex_session_reader.py— new reader for local Codex CLI history and OpenAI/GPT session sourcesbackend/app/services/agent_session_sources.py— optional provider registry/shared normalization helpersbackend/app/api/codex_sessions.py— new Codex/OpenAI API routes, or add provider-aware routes if the app standardizes under one endpoint familybackend/app/schemas/agent_sessions.py— shared provider-neutral schemas if extracting fromclaude_code.pybackend/app/schemas/claude_code.py— only touch if extending existing schemas is safer than introducing shared schemasbackend/tests/test_codex_session_reader.py— parser/fixture coveragebackend/tests/test_codex_sessions_api.py— API behavior coverageAffected routes or endpoints
Preferred provider-specific routes:
GET /api/v1/codex/sessionsGET /api/v1/codex/sessions/{session_id}GET /api/v1/codex/sessions/{session_id}/messagesGET /api/v1/codex/analytics/tools?days=7|30|90Optional provider-neutral routes if the implementation chooses to generalize first:
GET /api/v1/agent-sessions/sourcesGET /api/v1/agent-sessions/{source}/sessionsGET /api/v1/agent-sessions/{source}/sessions/{session_id}/messagesGET /api/v1/agent-sessions/{source}/analytics/tools?days=7|30|90Data-source requirements
~/.codexwhen available.CODEX_SESSIONS_PATHso tests and nonstandard installs do not depend on a hard-coded path.Codex CLI,OpenAI API, and future GPT sources.Normalized backend contract
session_idsource(claude_code,codex_cli,openai_api)provider_labelproject_dircwdtitlemodelstokenscost_usdbilling_sourcemessage_countfirst_message_atlast_message_atis_activeentrypointsgit_branchtool_countstop_files_readtop_files_writtentop_commandssession_countdate_range_dayssourcesource_statussource_pathlast_scanned_atSecurity and privacy requirements
~/.codex/auth.json.Expected behavior
Steps to reproduce (acceptance criteria)
CODEX_SESSIONS_PATHGET /api/v1/codex/sessionsGET /api/v1/codex/sessions/{session_id}/messagesGET /api/v1/codex/analytics/tools?days=30New opportunity to add
GET /api/v1/agent-sessions/sourcesto return source cards for the frontend:2-C: Backend: Codex CLI / OpenAI GPT Session Sourceto Phase 2-C: Backend Codex CLI / OpenAI GPT Session Source