Skip to content

feat(agent): Kimi model profiles + compaction side-call timeout scaling - #124

Merged
jkyberneees merged 1 commit into
mainfrom
feat/kimi-profile-sidecall-timeout
Jul 29, 2026
Merged

feat(agent): Kimi model profiles + compaction side-call timeout scaling#124
jkyberneees merged 1 commit into
mainfrom
feat/kimi-profile-sidecall-timeout

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Problem

Runs against api.kimi.com/coding failed mid-session with:

Error: iteration 4: llm: Post "https://api.kimi.com/coding/v1/chat/completions": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Two undersized timeouts:

  1. Main LLM call — Kimi models matched no entry in KnownProfiles, so they got the 120s default http.Client.Timeout. Kimi-for-coding with reasoning can exceed that to first byte on a large context.
  2. Compaction side callsummarizeDropped (and summarizeProgress) were hardcoded to a 30s context bound. If 120s isn't enough for a main call, 30s will essentially never be enough for compaction — and it fails silently (returns ""), so dropped turn groups vanish with no digest.

Changes

  • odek.go — new KnownProfiles entries for kimi- and k3 prefixes (the k3 family — k3, k3-256k — is the same Kimi Code line already recognized in modelForbidsTemperature): Timeout: 300, MaxContext: 262_144 (fallback only; /models discovery still takes priority).
  • internal/loop/loop.go — the 30s side-call bound is now Engine.SetSideCallTimeout (+ SideCallTimeout accessor); odek.New wires it to min(resolved client timeout, 120s). For Kimi, compaction now gets 120s instead of 30s.
  • docs/PROVIDERS.md — Kimi row added to the model profiles table.

Test coverage

  • TestLookupProfile_KimiMatch — profile resolution for kimi-for-coding, k3, k3-256k (timeout 300s, context 256K).
  • TestSideTimeout_DefaultAndOverride — 30s default, setter override, zero-resets-to-default.
  • TestNew_SideCallTimeoutScaling — end-to-end wiring through New(): kimi/k3 → 120s (capped), v4-pro → 120s (capped), v4-flash → 90s, unknown model → 120s default.

go build ./..., go vet, root package profile tests, and the full internal/loop suite pass.

- Add kimi- and k3 model profiles: 300s request timeout (slow
  time-to-first-byte with reasoning), 256K context fallback. Previously
  Kimi models hit the 120s default and failed with
  'Client.Timeout exceeded while awaiting headers'.
- Replace the hardcoded 30s bound on the compaction digest and
  progress-summary side calls with Engine.SetSideCallTimeout, wired to
  min(resolved client timeout, 120s). A slow provider otherwise silently
  lost the rolling digest on every trim (errors return "" by design).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 67780f4 Commit Preview URL

Branch Preview URL
Jul 29 2026, 09:23 AM

@jkyberneees
jkyberneees merged commit ae356d2 into main Jul 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant