Repository navigation
feat: support million-token context limit suffixes - #1985
Conversation
|
Hi maintainers! 👋 I’ve implemented the changes requested in #1977, including support for m/M suffixes, improved numeric validation, updated error messages, documentation, and regression tests. The relevant unit tests, type checks, and build pass locally. One known limitation: successful CLI integration tests are currently affected by an existing React duplicate-key/runtime issue. The PR is ready for review. I’d appreciate any feedback or suggestions for improvement. Thanks for your time! |
nc-review: comments — 3 important, 2 nits@KunjMaheshwari — a few things worth a look, none blocking. The PR adds 🟠 important · This is filed as
This PR adds a new user-facing capability ( 🟠 important · Rejecting bare fractional limits is a public-contract narrowing that rides along with the feature and is not called out anywhere a reviewer would look. On This reverses a decision the maintainers made on purpose: the base spec pins The new behaviour is defensible (rejecting an ambiguous token count is arguably better than silently rounding it), but it needs to be a stated decision rather than a side effect of the regex rewrite. Either say so explicitly in the PR description and the changeset, or keep bare fractions working and scope the change to the 🟠 important · The env-var path is where this PR fixes a real 1000x bug, but the new test only pins the new suffix, not the broken one. On Adding one case alongside the test('getModelContextLimit - env variable accepts the k suffix', async t => {
process.env.NANOCODER_CONTEXT_LIMIT = '128k';
t.is(await getModelContextLimit('unknown-model-12345'), 128000);
});⚪ nit · The new paragraph — "Context-limit overrides accept positive integers, or decimal values with a As written, a reader can reasonably infer that ⚪ nit · The PR description is still the unmodified template — every checkbox is unchecked and the body reads "Brief description of what this PR does". That is how the bare-fraction rejection above (a CLI behaviour change) ended up invisible to reviewers, since the only place it is mentioned is one clause of the changeset body. Filling in the description with what changed, which inputs are now rejected, and the bump level would make this PR reviewable at a glance. 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
|
Hi maintainers! I’ve addressed the automated review feedback and pushed the revisions. I’ve also synchronized the feature branch with the latest upstream main. The focused unit tests (134), TypeScript checks, and formatting checks are passing. I investigated the CLI integration test failures against both the original feature commit and upstream baseline and confirmed they are pre-existing runtime/test-environment issues. The PR is ready for another review. Thank you! |
|
Hi maintainers, I’ve completed another comprehensive audit of PR #1985 and pushed the final cleanup. During the audit, I identified and removed four unrelated generated Playwright snapshots to keep the PR focused exclusively on the context-limit feature. The latest commit is ef4e757. The focused test suite (134 tests), targeted coverage, TypeScript checks, formatting, linting, dependency analysis, and production build have passed. I also investigated the CLI integration failures against the upstream baseline and confirmed that the React/Ink and ACP provider-initialization issues are present there as well. Could a maintainer please approve the pending GitHub Actions workflow so that the required CI checks can execute? Once the checks complete, I’d appreciate a final code-owner review. Thank you for your time and consideration! |
|
Hi maintainers, Just following up on PR #1985. I’ve completed the implementation, addressed the automated review feedback, removed unrelated generated artifacts, and performed a final validation of the changes. The latest commit is ef4e757. Could someone with the required permissions please approve the pending GitHub Actions workflow so that the required checks can execute? I’d also appreciate a final code-owner review whenever convenient. Thank you for your time and consideration! |
will-lamerton
left a comment
There was a problem hiding this comment.
Thanks @KunjMaheshwari, the change itself looks good, and you've covered the automated feedback well (minor changeset, bare decimals still rounded, the 128k env test, docs limited to the string inputs). It also fixes a real bug: on main, NANOCODER_CONTEXT_LIMIT=128k is read with parseInt and becomes 128 tokens.
Needs a rebase. The branch is about 215 commits behind main and conflicts in 6 files. The main one: #2133 moved /context-max onto StatefulCommand and deleted source/app/utils/handlers/context-max-handler.ts and its spec. That logic now lives in source/commands/context-max.ts, so the new error message and examples need to move there, along with their tests.
Once it's rebased, we'll approve the CI workflows so they run on the final head.
Nit: the Number.isFinite(parsed) early return is redundant, since Number.isSafeInteger(limit) below already rejects Infinity.
|
Hi @KunjMaheshwari, thanks for this PR! It looks like a maintainer has left feedback Whenever you get a chance, could you take a look at the open comments? |
… documentation - Implemented m/M suffix support for context limits in --context-max and /context-max commands. - Enhanced numeric validation and updated error messages for better user experience. - Added regression tests for valid and invalid inputs to ensure reliability. - Updated documentation to reflect new features and usage examples. - Addressed feedback from previous reviews and improved overall code quality.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
ef4e757 to
57448b8
Compare
|
@will-lamerton Thanks for the detailed feedback! I’ve rebased the branch onto the latest main and resolved all six conflicts. I’ve also migrated the /context-max changes and tests to the new StatefulCommand implementation, removed the redundant Number.isFinite(parsed) check, and preserved the previously reviewed behavior and documentation updates. All local validations are passing, including:
I’ve pushed the updated changes to the existing PR. The GitHub Actions workflow is currently awaiting approval to run against the updated PR head. Thanks again for reviewing! |
|
Thanks @KunjMaheshwari, merged! Million-token limits like |
Summary
Introduces support for million-token context limits through the m/M suffix across Nanocoder’s string-based context-limit inputs.
This allows users to configure large context windows using intuitive values such as 1m instead of 1000k.
Key Changes
Configuration compatibility: Suffix notation applies to string-valued overrides. Numeric contextWindow and contextWindows fields in agents.config.json retain their existing numeric format.
Testing and Validation
The following checks have been performed locally:
The complete CLI integration suite has also been investigated. Failures involving React/Ink and ACP provider initialization must be distinguished from failures introduced by this change.
GitHub Actions status: Required CI checks are pending execution/approval and will be updated once the workflows have completed.
Release Notes
Includes a minor changeset for this user-facing feature.
Related Issue
Closes #1977 when this PR is merged.