Skip to content

Where to Change Code

Use this page as a maintainer routing map. It points common change requests to the source owners, validation paths, and documentation that should move with the code.

Runtime setting

Start in `src/config.rs`; update `config.example.toml`, wiring in `src/main.rs` or `src/lib.rs`, user docs, reference docs, and config-loading tests.

Inbound protocol parsing

Start in `src/ingress/` and `src/protocol/`; keep request protocol detection path-based and normalize before routing.

Route matching

Start in `src/routing/`; preserve strict `request_protocol` guard behavior and avoid silent fallthrough for mismatched explicit guards.

Provider request behavior

Start in `src/provider/*/request`; keep model rewrite, projection, and serialization provider-owned.

Provider transport

Start in `src/provider/*/transport`; keep auth headers, upstream URL construction, and HTTP send behavior outside pure translation.

Protocol conversion

Start in `src/translation/`; keep request/response/stream conversions pure at the carrier boundary.

Streaming semantics

Start in SSE scanner, streaming translation modules, and provider response observers; preserve terminal events, Unicode safety, and tool-call stall handling.

Client-facing errors

Start in `src/error/`; keep stable compact error projection and safe preserved upstream headers.

Capture/logging

Start in `src/observe/`; keep logs compact, structured, body-safe, and phase names aligned with reference docs.

  1. 1

    Add or change a runtime config field

    Goal: Keep runtime configuration centered on config.toml and its tracked example.

    Do
    • Update src/config.rs.
    • Add a concise example/comment to config.example.toml.
    • Wire through startup/runtime state only where needed.
    • Update using/configuration and reference/configuration.
    • Add or adjust config loading/default tests.

    Verify: just site check and relevant Rust config tests agree with the new default and docs.

  2. 2

    Add a protocol conversion path

    Goal: Preserve explicit pair-oriented translation.

    Do
    • Add request conversion only if inbound → provider request behavior is supported.
    • Add non-streaming response conversion if provider → inbound response behavior is supported.
    • Add streaming conversion separately; do not assume non-streaming support implies stream support.
    • Update compatibility docs and behavior tests.

    Verify: Unsupported pairs fail explicitly; supported pairs have behavior coverage for payloads and stream terminal semantics.

  3. 3

    Fix a streaming regression

    Goal: Preserve bytes, event order, terminal detection, and semantic timeouts.

    Do
    • Reproduce with the smallest stream fixture.
    • Identify whether the failure is carrier, SSE event semantics, protocol conversion, or client-facing reconstruction.
    • Add coverage for terminal events, incomplete tool streams, stalled tool-call arguments, or Unicode chunk boundaries as appropriate.

    Verify: Targeted streaming tests pass before broader e2e validation.

  4. 4

    Change error rendering

    Goal: Keep errors compact, stable, safe, and useful.

    Do
    • Map internal errors to stable client-facing types.
    • Preserve useful safe upstream headers such as Retry-After.
    • Avoid leaking private bodies, auth headers, API keys, or private prompts.
    • Update reference error types and behavior contracts.

    Verify: HTTP and SSE error behavior are both covered when stream state matters.

If you are changingPrimary source areaAlso check
CLI flagssrc/cli/README.md, README_CN.md, reference/cli
Generated app-directory defaultssrc/paths.rs, config loading codeconfig.example.toml, config tests
Route protocol guardssrc/routing/reference/route-matching, proxy e2e route tests
Provider model rewritesrc/provider/*/requestProvider setup docs and compatibility matrix
Anthropic wire structssrc/protocol/anthropic/SDK alignment docs and conversion tests
OpenAI Responses wire behaviorsrc/protocol/openai/responses/Responses protocol docs and conversion tests
Capture phase namessrc/observe/ and flow localsreference/capture-phases, docs checker phase coverage
Docs IA or bilingual pagessite/src/content/docs/tools/check_docs_i18n.py, developer/docs-maintenance

Prefer the smallest validation that covers the changed boundary, then move outward. For documentation-only work, run just site check. For runtime behavior, use the project validation guidance in AGENTS.md and the relevant test recipes.