get2knowio / get2knowio/airframe
Kimi adapter: live gaps (empty-config LLMNotSet, structured output) — blocked on MCP co-install (#29)
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Two real gaps in the Kimi adapter surfaced while verifying it live (in a separate `.venv-kimi`, since it can't co-install with `claude-agent-sdk` — see #29). Both are **deferred until the MCP conflict in #29 resolves**, because Kimi can't be exercised in CI or alongside the other providers until then.
## Gap 1 — `LLMNotSet` against a fresh setup (blocks all live use)
`KimiSession._ensure_sdk_session` passes `config=None` to `Session.create` and relies on the SDK's env-var augmentation (`KIMI_API_KEY` / `KIMI_BASE_URL` / `KIMI_MODEL_NAME`). But that augmentation only mutates a **pre-existing** "kimi"-type provider; a default `~/.kimi/config.toml` is empty (`providers = {}`, `models = {}`), so there's nothing to augment → `kosong … LLMNotSet: LLM not set`. The in-code comment at `kimi.py:1332-1338` already flags this as deferred ("a future iteration may route through Config properly").
**Proven fix** (spiked live — it reaches the Moonshot API): build a `kimi_cli.config.Config` from the adapter's resolved api_key / base_url / model and pass it as `config=` to `Session.create`:
```python
from kimi_cli.config import Config, LLMProvider, LLMModel
from pydantic import SecretStr
cfg = Config(
default_model=model_id,
models={model_id: LLMModel(provider="moonshot", model=model_id,
max_context_size=256_000, capabilities={"thinking"})},
providers={"moonshot": LLMProvider(type="kimi", base_url=base_url, api_key=SecretStr(api_key))},
)
sess = await Session.create(work_dir=…, config=cfg, model=model_id, yolo=…, thinking=…)
```
With this, `LLMNotSet` disappears and the request reaches Moonshot (verified: it then returned a 429 *account-balance* error — i.e. auth + config + request path all work).
## Gap 2 — structured output declared but not wired
`KimiSession._gate_and_coerce_prompt` (`kimi.py:1304-1314`) rejects `schema=` with `NotImplementedError`, yet the runtime declares `STRUCTURED_OUTPUT_JSON_SCHEMA = True` (a conformance requirement). Intended approach (per the module docstring): a forced `submit_result` tool mirroring `CopilotRuntime`. **Constraint discovered:** Kimi's `Session.create()` exposes only `agent_file` + `mcp_configs` (no in-process `tools=`, no `tool_choice`), so it must run a FastMCP `submit_result` server + force the call via system prompt + capture the args off the wire stream — and that forcing behavior **needs a live spike** to validate (no `tool_choice`).
## Status
- `KimiRuntime.execute()` runtime stub is fixed in #35 (the session layer already worked at the code level).
- Gaps 1 & 2 require a **funded Moonshot account** to verify live, AND **#29** (MCP alignment) so Kimi can co-install and run in CI alongside the rest. Both are blocked until then.
Contributor guide
Assessment
This issue has not been assessed yet.