Skip to content

[Feature] Accept an m suffix in --context-max and /context-max (1m) #1977

Closed

Description

@akramcodez

Description

--context-max and /context-max accept k as a suffix (128k) but not m, so --context-max 1m is rejected even though 1M-token context windows are now common.

Use Case

Many current models have 1M token windows. Typing 1000k works, but 1m is the obvious thing to write, and the error does not hint at the workaround.

Proposed Solution

Accept an m / M suffix (multiplier 1,000,000) in parseContextLimit. All three callers (cli.tsx, the /context-max handler and the inline overrides) share that one function, so the change is in one place. Update the two error messages that say e.g. 8192 or 128k to mention 1m as well.

While in there: a bare decimal such as 1.5 is currently accepted and rounded to 2, which is almost certainly a typo for 1.5k. Rejecting fractional values without a suffix would be safer.

Alternatives Considered

Leave it and document 1000k. It is a tiny change though, and the current failure is a confusing "Use a positive number" message for something that looks like a positive number.

Additional Context

  • I have searched existing issues to ensure this is not a duplicate
  • This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

Current behaviour of parseContextLimit on a few inputs: 128k -> 128000, 1m -> null, 1M -> null, 1.5 -> 2, 9999999999999999999999 -> 1e+22 (accepted). An upper sanity bound would be reasonable too, since the value is stored without further checks.

Activity

  1. added
    enhancement
    on Nov 6, 2026
  2. added
    needs-triage
    on Nov 6, 2026
  3. added
    area:cli
    good first issue
    and removed
    needs-triage
    on Nov 6, 2026
  4. KunjMaheshwari commented on Nov 6, 2026

    @KunjMaheshwari
    Contributor

    Hi maintainers! I'd like to work on this issue.

    I've reviewed the requirements and would be happy to implement support for both m and M suffixes, update the validation/error messages, and add the necessary regression tests.

    I also noticed that the existing tests allow bare decimal values (e.g. 1024.5). Should this behavior remain backward-compatible, or should bare decimals be rejected as mentioned in the issue?

    Thanks!

  5. addyCooks commented on Nov 7, 2026

    @addyCooks
    Collaborator

    Hi @KunjMaheshwari, thanks for your work on this!
    Going forward, please comment on an issue first and wait to be assigned before you start working on it.
    That way we avoid duplicate work and keep things fair for everyone.

    Thanks for contributing!

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

Metadata

Metadata

Labels

area:clienhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions