jcode icon indicating copy to clipboard operation
jcode copied to clipboard

jcode does not adhere to custom context limit

Open PwrBank opened this issue 5 months ago • 2 comments

Also hitting the over available context size issue...

Let me rewrite the conftest to use a proper async wrapper around synchronous SQLite, avoiding aiosqlite’s global connection cache entirely.
  ✓ write src/backend/tests/conftest.py (+70 -69) · 1.7k tok
┌─ diff
│ +"""Test configuration with fresh SQLite database per test."""
│ +import asyncio
│ -from sqlalchemy import text
│ -from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
│ -from sqlalchemy.pool import StaticPool
│ +from contextlib import asynccontextmanager
│ ... 127 more changes ...
│ + # Clean up the temp file
│ + if os.path.exists(db_path):
│ + try:
│ + os.remove(db_path)
│ + except OSError:
│ + pass
└─ (+70 -69 total)

OpenAI-compatible chat request failed
  endpoint: http://10.10.4.127:8080/v1/chat/completions
  model: ornith-box-1:/opt/models/ornith-1.0-35b-Q4_K_M.gguf
  auth: local endpoint (no auth)
  status: 400 Bad Request
  response: {"error":{"code":400,"message":"request (131263 tokens) exceeds the available context size (131072 tokens), try increasing it","type":"exceed_context_size_error","n_prompt_tokens":131263,"n_ctx":131072}}
Hint: check network connectivity, DNS/TLS, that the base URL includes the API version (usually /v1), and that the model exists on the provider.

It hit that around 90K context.

Originally posted by @PwrBank in #403

PwrBank avatar Jun 30 '26 11:06 PwrBank

Fixed on master in 0ed4140e.

Root cause: your configured context_window = 131072 was seeded into the global context-limit cache only under the bare lowercased model id, but the runtime request model was provider-qualified (cachyai-a2000:qwen3.6-35b-a2000-128k, and in the #403 follow-up a llama.cpp slash path ornith-box-1:/opt/models/ornith-1.0-35b-Q4_K_M.gguf). The qualified lookup missed the cache and budgeting fell back to the 200K default, which over-sent context against your 131K window (~90K visible + overhead ≈ 131,263 tokens at failure).

Configured per-model context_window values are now seeded under every lookup shape: bare id, slash base, and <profile>:<id>. Regression tests cover all four spec shapes from your reports.

1jehuang avatar Jul 03 '26 00:07 1jehuang

Closing: fixed on master in 0ed4140e (see comment above).

1jehuang avatar Jul 03 '26 00:07 1jehuang