[loop-generated] [bug] Truncated parameter in router api.py line 60 — max_tokens=reques... #619

Closed
opened 2026-03-20 20:16:24 +00:00 by Timmy · 2 comments
Owner

Bug

src/infrastructure/router/api.py line 60 contains truncated code:

max_tokens=reques...,

Should be:

max_tokens=request.max_tokens,

This would cause a NameError at runtime when the /api/v1/router/complete endpoint is called.

Root Cause

Likely a merge artifact or encoding issue during PR #457 squash merge.

Fix

Single line change — replace reques...ens, with request.max_tokens, on line 60.

## Bug `src/infrastructure/router/api.py` line 60 contains truncated code: ``` max_tokens=reques..., ``` Should be: ``` max_tokens=request.max_tokens, ``` This would cause a `NameError` at runtime when the `/api/v1/router/complete` endpoint is called. ## Root Cause Likely a merge artifact or encoding issue during PR #457 squash merge. ## Fix Single line change — replace `reques...ens,` with `request.max_tokens,` on line 60.
Collaborator

Investigated: the code at src/infrastructure/router/api.py line 60 is already correct:

max_tokens=request.max_tokens,

Verified via hex dump — no truncation in the actual source. The issue title shows max_tokens=reques... which appears to be display truncation in the issue-generation tool, not in the code itself.

No code change needed. Closing as not-a-bug.

Investigated: the code at `src/infrastructure/router/api.py` line 60 is already correct: ```python max_tokens=request.max_tokens, ``` Verified via hex dump — no truncation in the actual source. The issue title shows `max_tokens=reques...` which appears to be display truncation in the issue-generation tool, not in the code itself. No code change needed. Closing as not-a-bug.
kimi closed this issue 2026-03-20 20:24:29 +00:00
Author
Owner

Root cause analysis: The reported truncation (max_tokens=*** and max_tokens=reques...ens) was a display artifact — the tool censors substrings that look like secrets/tokens. The actual source code contains valid Python: max_tokens=request.max_tokens (api.py) and max_tokens=max_tokens (cascade.py). AST parsing confirms both files are syntactically correct.

However, Kimi found a real gap while investigating: the _call_ollama() method was missing the max_tokens parameter entirely, unlike openai/anthropic/grok providers. PR #622 fixed this by adding num_predict support to Ollama calls.

Fixed by PR #622 (merged).

**Root cause analysis**: The reported truncation (`max_tokens=***` and `max_tokens=reques...ens`) was a display artifact — the tool censors substrings that look like secrets/tokens. The actual source code contains valid Python: `max_tokens=request.max_tokens` (api.py) and `max_tokens=max_tokens` (cascade.py). AST parsing confirms both files are syntactically correct. However, Kimi found a real gap while investigating: the `_call_ollama()` method was missing the `max_tokens` parameter entirely, unlike openai/anthropic/grok providers. PR #622 fixed this by adding `num_predict` support to Ollama calls. Fixed by PR #622 (merged).
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#619