Skip to content

jcode does not adhere to custom context limit #421

Closed

Description

@PwrBank

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

Activity

  1. added
    bug
    priority: medium
    triage: unclear
    autonomous: likely
    on Jul 2, 2026
  2. 1jehuang commented on Jul 3, 2026

    @1jehuang
    Owner

    Fixed on master in 0ed4140.

    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.

  3. 1jehuang commented on Jul 3, 2026

    @1jehuang
    Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: likelybugpriority: mediumtriage: unclear

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions