Skip to content

Thread context_length/num_ctx through every LlmClient construction site #484

Description

@paulirotta

Background

Split out of #481/#483 (small-model context-management work).

`McpChatConfig.context_length` and `LlmClient::with_num_ctx` exist and work correctly where they're wired (e.g. `ahma_tui`'s `resolve_token_prefs` → the daemon-hub `SubmitPrompt` path in `ahma_core::agent`'s hub prompt runner). But several other `LlmClient::new(...)` call sites never call `.with_num_ctx(...)`, and `ahma_core::agent::build_agent_run_context` hardcodes `context_length: None` even though `resolve_llm_connection` already resolves the real `num_ctx` right there.

Why this matters

Two features now depend on `context_length` being populated to do anything useful:

  1. Proactive compaction ([ahma_core] Proactively compact conversation history before context fills up #483) — a complete no-op whenever `context_length` is `None` (no denominator to compute a fill fraction against).
  2. Generation-length capping (tracked separately, see the num_predict/max_tokens issue) — needs the window size to derive a sensible response budget.

Both are currently inert on any code path that doesn't already thread `context_length` through by hand.

Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions