todo2code

Participant: codex (AI agent)

Understanding

Todo2code currently owns a direct OpenRouter transport and therefore ignores the central Z.AI-first policy and shared credential file. The least invasive repair is inside the existing src/llm/** boundary: resolve a single semantic route from the Python SubLLM package, then translate the already validated structured request onto the selected OpenAI-compatible provider. Existing extractors, synthesis stages and public APIs do not need to change.

Provider selection must happen before the request. Runtime errors after a paid request starts are not replayed through a second provider. The bridge may hold the selected credential in memory, as existing Python consumers do, but must never include it in subprocess output, errors, audits or persisted metadata.

Execution plan

  1. Add todo2code plus its semantic function to SubLLM and verify route ordering, identity and credential-shape behavior.
  2. Add one internal Node bridge under src/llm/** that invokes the installed Python package without a shell, resolves public route metadata, reads only the selected credential under SubLLM’s validated file contract and caches it in memory.
  3. Adapt the existing transport to emit provider-specific bodies: Z.AI gets user_id and request_id; OpenRouter gets its attribution headers and stable user; OpenRouter-only plugins are omitted for direct Z.AI.
  4. Update the Platform intent-gate caller in its owning repository so semantic availability and model selection come from SubLLM rather than a hardcoded OpenRouter credential check.
  5. Run focused negative/security tests, full SubLLM and todo2code suites, governance and Docker checks, then one minimal live structured Z.AI probe.

Actual changes

Blockers