Skip to content

Commit da71e1e

Browse files
author
hrishi mane
committed
docs(patch): refresh PATCH.md for upstream PR pingdotgg#2246 descriptor refactor
Replace the per-provider normalizer trap with the descriptor-driven pipeline. Expand the conflict-zones table with every file rewritten during the sync. Update verification checklist line 4 count (now 4 lists) and line 4a to check for the `agent` descriptor wiring.
1 parent 0004576 commit da71e1e

1 file changed

Lines changed: 34 additions & 21 deletions

File tree

PATCH.md

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,24 @@ Every shared-file edit is a _pure addition_ (new case in a union, new entry in a
187187

188188
## Hidden Traps — Read Before Adding Another Provider
189189

190-
### Per-provider normalizers silently drop unknown options
190+
### Provider model options are now descriptor-driven (post upstream PR #2246)
191191

192-
`normalizeProviderModelOptionsWithCapabilities` in `packages/shared/src/model.ts` is a switch on `ProviderKind` — every provider needs an explicit `case`. The default (no match) returns `undefined`, which strips all model options on the dispatch path **before** they reach the server.
192+
As of the 2026-04-24 sync, `modelSelection.options` is `ReadonlyArray<ProviderOptionSelection>` where each selection is `{ id, value }`. Providers expose their supported options via `ModelCapabilities.optionDescriptors` on each `ServerProviderModel`. The per-provider `normalizeXxxModelOptionsWithCapabilities` helpers that used to exist in `packages/shared/src/model.ts` have been deleted — the generic descriptor pipeline in `composerProviderState.tsx` handles dispatch uniformly for every provider.
193193

194-
The bite: the composer draft store happily stores `{ agent: "..." }` and the TraitsPicker shows the right selection, but `getProviderStateFromCapabilities` runs the dispatch payload through this normalizer. Missing case `modelSelection.options` becomes `undefined` in the turn → server-side respawn logic never sees an agent change.
194+
**Kiro agent picker wiring:** `KiroProvider.ts` injects a `buildSelectOptionDescriptor({ id: "agent", label: "Agent", options: ... })` into every model's capabilities when `kiro-cli agent list` returns agents. No per-provider normalizer case is needed.
195195

196-
Verify after adding a provider:
196+
**KiroAdapter reads agent selection via the generic helper:**
197+
```ts
198+
import { getProviderOptionStringSelectionValue } from "@t3tools/shared/model";
199+
const agent = getProviderOptionStringSelectionValue(modelSelection.options, "agent");
200+
```
201+
202+
Verify when adding a new provider feature:
197203

198204
```bash
199-
rg 'case "<provider>"' packages/shared/src/model.ts
205+
rg 'buildSelectOptionDescriptor.*id: "<option-id>"' apps/server/src/provider/Layers/<Provider>Provider.ts
200206
```
201207

202-
**Ideal fix (not yet done):** same `PROVIDER_KINDS` tuple from contracts would let this switch exhaustiveness-check at compile time.
203-
204208
### The three-hardcoded-lists bug (composerDraftStore.ts)
205209

206210
`composerDraftStore.ts` is the per-thread composer draft store. It has **three hardcoded `ProviderKind` lists** that every new provider must be added to. If you miss any one of them, the symptom is silent:
@@ -243,17 +247,26 @@ Upstream's `makeManagedServerProvider` exposes `enrichSnapshot` for static provi
243247

244248
## Likely Conflict Zones When Syncing
245249

246-
| File | Why it conflicts |
247-
| ------------------------------------------------------- | ------------------------------- |
248-
| `packages/contracts/src/orchestration.ts` | ProviderKind union |
249-
| `apps/server/src/server.ts` | RuntimeServicesLive layer chain |
250-
| `apps/server/src/provider/Layers/ProviderRegistry.ts` | Provider registration list |
251-
| `apps/server/src/provider/providerStatusCache.ts` | `PROVIDER_CACHE_IDS` array |
252-
| `apps/server/src/provider/acp/AcpSessionRuntime.ts` | Optional `authMethodId`; `sessionId` plumbing for subagent filtering |
253-
| `apps/server/src/provider/acp/AcpRuntimeModel.ts` | `sessionId` on `AcpParsedSessionEvent` variants |
254-
| `apps/server/src/provider/makeManagedServerProvider.ts` | Added `patchSnapshot` |
255-
| `apps/web/src/composerDraftStore.ts` | Three provider-kind lists |
256-
| `apps/web/src/components/settings/SettingsPanels.tsx` | Provider panel registration |
250+
| File | Why it conflicts |
251+
| ----------------------------------------------------------- | --------------------------------------------------------------------- |
252+
| `packages/contracts/src/orchestration.ts` | ProviderKind union + KiroModelSelection variant |
253+
| `packages/contracts/src/model.ts` | kiro entries in DEFAULT_*/ALIASES records |
254+
| `packages/contracts/src/settings.ts` | KiroSettings + KiroSettingsPatch + providers map entry |
255+
| `apps/server/src/server.ts` | RuntimeServicesLive layer chain |
256+
| `apps/server/src/provider/Layers/ProviderRegistry.ts` | kiro wired into createBuiltInProviderSources + KiroProviderLive merge |
257+
| `apps/server/src/provider/Layers/ProviderAdapterRegistry.ts`| kiro wired into createBuiltInAdapterList |
258+
| `apps/server/src/provider/builtInProviderCatalog.ts` | BUILT_IN_PROVIDER_ORDER + BuiltInAdapterMap extended with kiro |
259+
| `apps/server/src/provider/providerStatusCache.ts` | `PROVIDER_CACHE_IDS` array includes "kiro" |
260+
| `apps/server/src/provider/acp/AcpSessionRuntime.ts` | Optional `authMethodId`; `sessionId` plumbing for subagent filtering |
261+
| `apps/server/src/provider/acp/AcpRuntimeModel.ts` | `sessionId` on `AcpParsedSessionEvent` variants |
262+
| `apps/server/src/provider/makeManagedServerProvider.ts` | Added `patchSnapshot` + slashCommands merge across refreshes |
263+
| `apps/server/src/git/Layers/RoutingTextGeneration.ts` | kiro routed through OpenCodeTextGenerationLive |
264+
| `apps/web/src/composerDraftStore.ts` | Four provider-kind lists (normalizer + 3 loops) |
265+
| `apps/web/src/modelSelection.ts` | kiro entry in `getCustomModelOptionsByProvider` Record |
266+
| `apps/web/src/components/chat/composerProviderState.tsx` | `TraitsRenderInput` extended with `open`/`onOpenChange` for `/agent` |
267+
| `apps/web/src/components/chat/ChatComposer.tsx` | `providerHasAgentPicker` replaced with descriptor check |
268+
| `apps/web/src/components/chat/TraitsPicker.tsx` | controlled-open state support for `/agent` slash command |
269+
| `apps/web/src/components/settings/SettingsPanels.tsx` | Provider panel registration |
257270

258271
## Post-Rebuild Verification Checklist
259272

@@ -262,12 +275,12 @@ After every sync, rebuild, or conflict resolution — run all of these:
262275
1. `rg '"kiro"' packages/contracts/src/orchestration.ts``"kiro"` in `ProviderKind` union
263276
2. `rg '"kiro"' apps/server/src/provider/providerStatusCache.ts` — in `PROVIDER_CACHE_IDS`
264277
3. `rg 'KiroProviderLive' apps/server/src/server.ts` — wired in `RuntimeServicesLive`
265-
4. `rg '"kiro"' apps/web/src/composerDraftStore.ts | wc -l` — should be ≥ 3 (the three lists)
266-
4a. `rg 'case "kiro"' packages/shared/src/model.ts`kiro case wired in `normalizeProviderModelOptionsWithCapabilities`
278+
4. `rg '"kiro"' apps/web/src/composerDraftStore.ts | wc -l` — should be ≥ 4 (normalizer + 3 loops)
279+
4a. `rg 'buildSelectOptionDescriptor.*id: "agent"' apps/server/src/provider/Layers/KiroProvider.ts`agent descriptor wired when agents are discovered
267280
5. `bun install` — lockfile resolves cleanly
268281
6. `bun typecheck` — 0 errors
269282
7. `bun fmt && bun lint` — clean
270-
8. `bun test` — current baseline: 99 files / 902 passing, 1 file / 4 tests skipped
283+
8. `bun run test` — current baseline (post-2026-04-24 sync): 100 files / 933 passing, 1 file / 4 tests skipped
271284
9. `bun run dev` — launch, pair, enable Kiro in settings, select a Kiro model, open agent picker, verify agent list populates
272285
10. Manual: type `/` in composer → slash commands and MCP prompts populate
273286

0 commit comments

Comments
 (0)