Skip to content

Commit 543f19c

Browse files
author
Aleksandr Slapoguzov
committed
LLM-25226 Add codex-update-compat skill for future Codex migrations
- add reusable Codex skill for updating Codex versions safely - include migration workflow for typecheck/test-driven compatibility fixes - document common app-server schema breakages and event-mapping patterns - include QA-oriented notes for env-dependent auth/keychain test failures
1 parent 83702c4 commit 543f19c

3 files changed

Lines changed: 143 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: codex-update-compat
3+
description: Upgrade Codex in this repository and resolve compatibility regressions caused by app-server schema/protocol changes. Use when bumping Codex/npm package versions, regenerating `src/app-server` types, fixing TypeScript errors after update, repairing event mappings, and updating tests/snapshots to match new Codex behavior (especially model list, thread/session fields, sandbox policy shape, and tool/event notifications).
4+
---
5+
6+
# Codex Update Compat
7+
8+
Use this workflow to safely upgrade Codex and close update-induced regressions.
9+
10+
## Workflow
11+
12+
1. Inspect update scope before changing code.
13+
Run:
14+
```bash
15+
git log --oneline -n 5
16+
git show --name-only --oneline -n 1
17+
```
18+
Focus first on `package.json`, `package-lock.json`, and generated `src/app-server/**` changes.
19+
20+
2. Run typecheck and tests immediately.
21+
Run:
22+
```bash
23+
npm run typecheck
24+
npm test
25+
```
26+
Treat type errors as the migration guide for required protocol changes.
27+
28+
3. Fix runtime compatibility in source files.
29+
Typical hotspots:
30+
- `src/CodexAcpClient.ts`: thread start/resume params and initialize capabilities
31+
- `src/AgentMode.ts`: sandbox policy shape changes
32+
- `src/CodexEventHandler.ts`: new/changed server notifications
33+
- `src/CodexAcpServer.ts`: history replay for new `ThreadItem` variants
34+
- `src/CodexToolCallMapper.ts`: mapping new tool-like items to ACP events
35+
36+
4. Fix test fixtures and snapshots.
37+
Update typed fixtures for new required fields instead of weakening types.
38+
Then update snapshots only after behavior is intentionally verified.
39+
40+
5. Re-run targeted suites, then full checks.
41+
Run focused tests for touched behavior, then:
42+
```bash
43+
npm run typecheck
44+
npm test
45+
```
46+
47+
## Non-Trivial Changes: Ask Before Finalizing
48+
49+
When migration requires behavior decisions (not only schema fixes), ask the user first. Examples:
50+
- Enabling/disabling experimental flags (`persistExtendedHistory`, `experimentalApi`)
51+
- User-visible messaging changes for new events (e.g., model reroute wording)
52+
- Converting integration tests to mocks or skipping env-dependent tests
53+
54+
## Event Mapping Rule
55+
56+
Do not silently drop new event/item variants if they should be visible to users.
57+
Map them to ACP updates:
58+
- Tool-like operations -> `tool_call` / `tool_call_update`
59+
- Informational reasoning/infra events -> `agent_thought_chunk` (if user-meaningful)
60+
- Internal/noise events -> explicit no-op case (documented in switch)
61+
62+
## References
63+
64+
For common break patterns and ready fixes, read:
65+
- `references/codex-update-playbook.md`
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Codex Update Compat"
3+
short_description: "Upgrade Codex and resolve compatibility"
4+
default_prompt: "Update Codex, run typecheck/tests, and fix app-server compatibility regressions."
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Codex Update Playbook
2+
3+
Use this checklist when Codex version bumps cause compile/test breakage.
4+
5+
## Common Type Breakages
6+
7+
1. New required model fields.
8+
Symptoms:
9+
- `Property 'hidden' is missing in type ...`
10+
Fix:
11+
- Add `hidden: false` (or expected value) in all `Model` fixtures.
12+
13+
2. Thread shape expansion.
14+
Symptoms:
15+
- Missing `status`, `agentNickname`, `agentRole`, `name` in `Thread`.
16+
Fix:
17+
- Add these fields in test fixtures and mocks.
18+
19+
3. Thread item schema changes.
20+
Symptoms:
21+
- `agentMessage` missing `phase`.
22+
Fix:
23+
- Add `phase: null` unless specific phase is required by test.
24+
25+
4. Rate limits payload changes.
26+
Symptoms:
27+
- Missing `limitId` / `limitName` in `RateLimitSnapshot`.
28+
Fix:
29+
- Include `limitId` and `limitName` under `rateLimits` snapshot object.
30+
- If notification wrapper changed, map from new shape in handler.
31+
32+
5. Sandbox policy contract changes.
33+
Symptoms:
34+
- Missing `access` for read-only or `readOnlyAccess` for workspace-write policy.
35+
Fix:
36+
- Provide required nested objects in policy fixtures and runtime mapping.
37+
38+
6. Thread start/resume required flags.
39+
Symptoms:
40+
- Missing `persistExtendedHistory`.
41+
Fix:
42+
- Set explicitly in `threadStart` and `threadResume` params.
43+
- Keep `false` unless user confirms enabling experimental behavior.
44+
45+
## Event Compatibility Patterns
46+
47+
1. New tool-like items/events.
48+
Approach:
49+
- Add mapper function in `CodexToolCallMapper.ts`.
50+
- Emit `tool_call` on start and `tool_call_update` on completion.
51+
- Include meaningful `kind`, `title`, and `rawInput`.
52+
53+
2. Streaming/progressive session events.
54+
Approach:
55+
- Keep stable `toolCallId`.
56+
- First event: `tool_call`, subsequent events: `tool_call_update`.
57+
- Completion event should set `status: completed` or `failed`.
58+
59+
3. Informational infra events (e.g., model reroute).
60+
Approach:
61+
- Emit `agent_thought_chunk` with concise user-readable text.
62+
63+
## Test Strategy
64+
65+
1. Fix types first (`npm run typecheck`).
66+
2. Run focused tests for touched event/file.
67+
3. Update snapshots only after confirming expected behavior.
68+
4. Run full suite at end.
69+
70+
## Known Env-Dependent Failures
71+
72+
Authentication integration tests may fail on CI/local machines due OS keychain restrictions:
73+
- examples: `failed to save api key`, `logout failed`, `Operation not permitted`.
74+
Treat separately from migration regressions.

0 commit comments

Comments
 (0)