Skip to content

fix(ai): gateway tune fails on large prompts and ignores weight and concurrency settings #669

Closed

Description

@dan-petty

Summary

Found in the release/v0.2.23 review (line numbers at 7fdaa9d).

  1. Large prompts fail with "Argument list too long". devops ai gateway tune passes the whole review-page prompt to kubectl debug as a single python -c argument (src/devops_cli/ai/gateway_tune.py:387-397, :514-527). The prompt size comes from src/devops_cli/commands/ai_gateway.py:434-438.
    • Above about 32K prompt tokens, that argument exceeds Linux's 131,072-byte per-argument limit. At the shipped 64K context it is 148 KB, and --prompt-tokens >= 32047 triggers the same failure.
    • Each run also appears to add an 80-150 KB ephemeral container to the gateway pod's spec, growing the object (unconfirmed).
  2. Weight overrides are matched inconsistently. ai.gateway_weights is matched by deployment ID after a successful sweep, but by backend label in the hardware-only fallback (gateway_tune.py:151-154 vs :227-229). A label-keyed override such as {vllm: 8} is silently ignored after a sweep.
  3. ai.gateway_concurrency does nothing. It is read from config (src/devops_cli/config/settings.py:415-416), but never used; calculate_hardware_concurrency is only called from tests.

Remediation Plan

  1. Send the prompt through stdin or a file instead of argv, and reuse one debug container per run.
  2. Match weight overrides by deployment ID or backend label on both paths.
  3. Use the concurrency setting, or remove it.
  4. Add tests:
    • a prompt over 131,072 bytes is delivered;
    • label-keyed weights apply after a sweep;
    • the concurrency setting takes effect.

Activity

  1. added this to the v0.2.23 milestone on Sep 28, 2026
  2. added
    type/bug
    scope/ai
    priority/p2-medium
    on Sep 28, 2026
  3. dan-petty commented on Sep 28, 2026

    @dan-petty
    OwnerAuthor

    Resolved by #677 in release/v0.2.23.

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

    priority/p2-mediumscope/aitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions