|
| 1 | +# 2026-06-23 PR #16/#22 Dev Integration Plan |
| 2 | + |
| 3 | +## Objective |
| 4 | + |
| 5 | +Absorb the remaining open PRs into `dev` without routing them through the GitHub PR merge button: |
| 6 | + |
| 7 | +- PR #16: static provider model catalogs via `liveModels: false`. |
| 8 | +- PR #22: Anthropic Messages tool-result history repair. |
| 9 | + |
| 10 | +The final state must preserve existing live `/models` discovery by default, keep static allowlists opt-in only, fix invalid Anthropic `tool_result` history shapes, push `dev`, and close both superseded PRs with attribution. |
| 11 | + |
| 12 | +## Current State |
| 13 | + |
| 14 | +- Repository: `/Users/jun/Developer/new/700_projects/opencodex` |
| 15 | +- Branch: `dev` |
| 16 | +- Latest release baseline: `v2.1.7` / `241e327 release: v2.1.7` |
| 17 | +- Open PRs: |
| 18 | + - `#16 [codex] Allow static provider model catalogs` by `0disoft`, mergeable, CI green. |
| 19 | + - `#22 fix anthropic tool result history` by `jaekwonhong`, draft, mergeable, no reported checks. |
| 20 | + |
| 21 | +## Planned Changes |
| 22 | + |
| 23 | +### MODIFY `src/types.ts` |
| 24 | + |
| 25 | +Add optional provider config: |
| 26 | + |
| 27 | +```ts |
| 28 | +liveModels?: boolean; |
| 29 | +``` |
| 30 | + |
| 31 | +Behavior: |
| 32 | + |
| 33 | +- `undefined` and `true` keep the current live `/models` behavior. |
| 34 | +- `false` means `models` is an intentional static Codex catalog allowlist. |
| 35 | + |
| 36 | +### MODIFY `src/codex-catalog.ts` |
| 37 | + |
| 38 | +Change `fetchProviderModels` order: |
| 39 | + |
| 40 | +1. Skip forward providers and unresolved OAuth providers as today. |
| 41 | +2. Build configured model hints first from `prov.models`. |
| 42 | +3. If `prov.liveModels === false`, return configured models immediately. |
| 43 | +4. Do not write static allowlists into the live model cache. |
| 44 | +5. Otherwise use fresh cache, live `/models`, stale cache, and configured fallback as today. |
| 45 | + |
| 46 | +This preserves the existing dashboard `/api/models`, Codex `/v1/models`, and catalog sync behavior because all three already route through `gatherRoutedModels(config)`. |
| 47 | + |
| 48 | +### MODIFY `tests/codex-catalog.test.ts` |
| 49 | + |
| 50 | +Add/absorb regression tests: |
| 51 | + |
| 52 | +- `liveModels:false` never calls `fetch`. |
| 53 | +- A fresh live cache cannot override a static allowlist. |
| 54 | +- Static allowlists do not poison the live cache after toggling back to live models. |
| 55 | +- Config catalog hints still apply to static configured models, specifically `modelContextWindows` |
| 56 | + and `modelInputModalities` on a `liveModels:false` provider. |
| 57 | + |
| 58 | +### MODIFY docs |
| 59 | + |
| 60 | +Update configuration reference pages: |
| 61 | + |
| 62 | +- `/Users/jun/Developer/new/700_projects/opencodex/docs-site/src/content/docs/reference/configuration.md` |
| 63 | +- `/Users/jun/Developer/new/700_projects/opencodex/docs-site/src/content/docs/ko/reference/configuration.md` |
| 64 | +- `/Users/jun/Developer/new/700_projects/opencodex/docs-site/src/content/docs/zh-cn/reference/configuration.md` |
| 65 | + |
| 66 | +Document: |
| 67 | + |
| 68 | +- `models` remains seed/fallback by default. |
| 69 | +- `liveModels:false` makes `models` an exact allowlist. |
| 70 | +- Empty `models` with `liveModels:false` exposes no routed models. |
| 71 | + |
| 72 | +### MODIFY `src/adapters/anthropic.ts` |
| 73 | + |
| 74 | +Repair Anthropic tool-result history conversion: |
| 75 | + |
| 76 | +- Adjacent `toolResult` messages immediately following assistant `tool_use` blocks must be folded into one user message containing Anthropic `tool_result` blocks. |
| 77 | +- Missing tool results should be represented by synthetic `is_error: true` tool_result blocks so the request stays valid. |
| 78 | +- Duplicate or orphan tool results should be preserved as text instead of invalid standalone Anthropic `tool_result` blocks. |
| 79 | +- Image/tool content blocks should continue using existing `toAnthropicContentPart`. |
| 80 | + |
| 81 | +### MODIFY `tests/adapter-usage.test.ts` |
| 82 | + |
| 83 | +Add/absorb regression tests: |
| 84 | + |
| 85 | +- Multiple adjacent tool results are folded into one user message. |
| 86 | +- Missing tool result is synthesized with `is_error: true`. |
| 87 | +- Orphan tool result is preserved as text. |
| 88 | +- Duplicate tool results after one matching assistant `tool_use` are preserved as text, not a |
| 89 | + second invalid Anthropic `tool_result` block. |
| 90 | +- Non-string tool-result content, including image content, still maps through Anthropic content |
| 91 | + blocks. |
| 92 | +- Existing OpenAI Chat history repair tests remain green. |
| 93 | + |
| 94 | +## Integration Strategy |
| 95 | + |
| 96 | +1. Enter PABCD `A` and dispatch a read-only plan audit. |
| 97 | +2. Merge PR #16 into local `dev` using git, preserving contributor history where practical. |
| 98 | +3. Merge PR #22 into local `dev`, despite draft status, because the user explicitly authorized absorbing and closing it. |
| 99 | +4. Resolve conflicts manually if needed; add small follow-up patch if PR code regresses existing metadata caps or cache semantics. |
| 100 | +5. Run focused verification: |
| 101 | + - `bun test tests/codex-catalog.test.ts` |
| 102 | + - `bun test tests/adapter-usage.test.ts tests/umans-provider.test.ts` |
| 103 | + - `bun run typecheck` |
| 104 | +6. Run full verification: |
| 105 | + - `bun test tests` |
| 106 | + - `cd docs-site && bun run build` |
| 107 | + - `git diff --check` |
| 108 | +7. Commit or preserve merge commits atomically. |
| 109 | +8. Push `dev` to `origin/dev`. |
| 110 | +9. Comment on PR #16 and PR #22 with absorbed commit/evidence and close them. |
| 111 | +10. Record final goal evidence and pause the goal with an independent stop audit. |
| 112 | + |
| 113 | +## Risks |
| 114 | + |
| 115 | +- PR #16 could accidentally make static allowlists the default. Mitigation: tests assert the default live path still fetches. |
| 116 | +- PR #16 could pollute the live model cache with static allowlists. Mitigation: cache toggle test. |
| 117 | +- PR #22 could alter valid Anthropic history order. Mitigation: focused adapter tests plus existing usage tests. |
| 118 | +- PR #22 is draft. Mitigation: do not GitHub-merge the draft PR; absorb into `dev` with explicit user authorization and close as superseded. |
| 119 | + |
| 120 | +## Completion Evidence Required |
| 121 | + |
| 122 | +- Documentation: this devlog plan plus final devlog notes. |
| 123 | +- Implementation: changed source/tests/docs paths listed above. |
| 124 | +- Verification: focused tests, typecheck, full tests, docs build, diff check. |
| 125 | +- GitHub: `origin/dev` updated, PR #16 and #22 commented and closed. |
0 commit comments