Skip to content

feat(agent-client): port Codex steer/compact/review/trust/permissions to CodexThreadClient#7

Open
huntharo wants to merge 1 commit into
mainfrom
claude/codex-feature-port
Open

feat(agent-client): port Codex steer/compact/review/trust/permissions to CodexThreadClient#7
huntharo wants to merge 1 commit into
mainfrom
claude/codex-feature-port

Conversation

@huntharo

@huntharo huntharo commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Adds the rich Codex thread operations the in-tree PwrAgent client had but CodexThreadClient lacked, so hosts (PwrAgent, PwrSnap) can drive them through the kit instead of a bespoke in-tree client.

New Codex-native methods on CodexThreadClient

method wire call returns
steerTurn({ threadId, input, expectedTurnId }) turn/steer { threadId, turnId }
compactThread(threadId) thread/compact/start { threadId, turnId, itemId? }
startReview({ threadId, target, delivery?, cwd? }) review/start { threadId, reviewThreadId, turnId }
setThreadPermissions({ threadId, model?, approvalPolicy?, sandbox?, serviceTier?, cwd? }) thread/resume overlay { threadId }
trustProject({ projectPath, configPath? }) config/value/write { projectPath, configPath? }

All turn-producing methods stream their output through the existing normalizeNotification → onEvent path — subscribers see normalized NormalizedThreadEvents with no extra wiring. Ids are extracted with tolerance for snake_case / nested turn shapes via a small ported codex-extract helper (asRecord/pickString/extract*).

Design

  • Methods are Codex-native (not added to the neutral AgentBackend interface), slotting alongside the existing startThreadNative/startTurnNative pair — they have no cross-backend analog.
  • Logic ported from PwrAgent's in-tree CodexAppServerClient reference implementations. setThreadPermissions matches in-tree behavior: reasoning effort is a per-turn (turn/start) setting, not a resume field, so resume doesn't carry it.

Tests

6 new tests drive each method through a fake transport (wire method + payload + id extraction + fallbacks). Full @pwrdrvr/agent-client suite: 46 passing. Typecheck + build green.

Consumer

PwrAgent's CodexKitBackendClient (PwrAgent PR #679) calls these to make its PWRAGENT_CODEX_KIT path support steer/compact/review — no longer core-chat-only. That PR currently links a local tarball of this branch; once this lands and a version is published, it switches to the version pin.

🤖 Generated with Claude Code

… to CodexThreadClient

Adds the rich Codex thread operations that the in-tree PwrAgent client had but
CodexThreadClient lacked, so hosts can drive them through the kit:

- steerTurn(threadId, input, expectedTurnId) → turn/steer (inject input into the
  in-flight turn; precondition-guarded)
- compactThread(threadId) → thread/compact/start (summarize history)
- startReview({threadId, target, delivery?}) → review/start (inline/detached)
- setThreadPermissions(...) → thread/resume overlay (model/approval/sandbox/tier)
- trustProject({projectPath, configPath?}) → config/value/write

All turn-producing methods stream their output through the existing
normalizeNotification → onEvent path, so subscribers see normalized events with
no extra wiring. Id extraction tolerates snake_case / nested `turn` shapes via a
small ported codex-extract helper (asRecord/pickString/extract*). Methods are
Codex-native (not on AgentBackend), slotting alongside startThreadNative.

6 new tests drive each method through a fake transport (wire method + payload +
id extraction + fallbacks). Full agent-client suite: 46 passing. Typecheck +
build green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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