feat: generalize session markers to support Codex, Amp, etc#107
Conversation
- Add SupportsSession() and SessionID() to Agent interface - Implement for all 15 agents and 2 orchestrators - Rename Claude-specific to agent-agnostic: ClaudeSessionID→AgentSessionID - Add comprehensive documentation on marker lifecycle and cleanup - Update all callers and tests Co-Authored-By: SageOx <ox@sageox.ai>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (28)
📝 WalkthroughWalkthroughThe PR generalizes Claude-specific session handling to agent-agnostic context across the codebase. It introduces a new AgentSession interface, renames session-related functions and types (ClaudeSessionID → AgentSessionID, ReadClaudeHookInput → ReadAgentHookInput, etc.), implements the new interface across all agent types, and updates tests accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: SageOx <ox@sageox.ai>
Summary
Adds
SupportsSession()andSessionID()methods to theAgentinterface, enabling agent-agnostic session identification across all 15 coding agents and 2 orchestrators. Generalizes session marker naming and documentation from Claude-specific to agent-agnostic terminology. Wires the env-var fallback into the prime flow so Codex, Amp, and Claude Code sessions create markers even outside hook context.Changes
AgentSessioninterface withSupportsSession()andSessionID()methods, embedded inAgentagent.SessionID(env)when hook stdin doesn't provide a session ID — enables Codex (CODEX_THREAD_ID), Amp (AMP_THREAD_URL), and Claude Code (CLAUDE_CODE_SESSION_ID) to create session markers nativelyClaudeSessionID→AgentSessionID,ReadClaudeHookInput()→ReadAgentHookInput(), etc./tmpare ephemeral, OS cleans on reboot)flowchart TD A[ox agent prime] --> B{Hook stdin<br/>has session_id?} B -- Yes --> D[Use hook session ID] B -- No --> C{agent.SupportsSession()?} C -- Yes --> E[agent.SessionID env] C -- No --> F[No session tracking] E --> G{SessionID non-empty?} G -- Yes --> D G -- No --> F D --> H[Write/check session marker]Verification
go test -short ./cmd/ox/ ./pkg/agentx/...)TestSessionIDFallbackFromEnvVar)Session Recording
View session recording
Co-Authored-By: SageOx ox@sageox.ai
Summary by CodeRabbit
Release Notes
New Features
Improvements