Skip to content

Conversation

qnixsynapse
Copy link
Contributor

@qnixsynapse qnixsynapse commented Sep 12, 2025

Describe Your Changes

The previous implementation added the --no-context-shift flag when cfg.ctx_shift was disabled, which conflicted with the llama.cpp CLI where the presence of --context-shift enables the feature. The logic is updated to push --context-shift only when cfg.ctx_shift is true, ensuring the extension passes the correct argument and behaves as expected.

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Fixes context shift flag handling in LlamaCPP extension and adds error handling for out-of-context conditions.

  • Behavior:
    • Corrects context shift flag logic in llamacpp_extension class in index.ts to add --context-shift only when cfg.ctx_shift is true.
    • Adds error handling for out-of-context conditions in handleStreamingResponse() and chat() functions.
  • Misc:
    • Introduces OUT_OF_CONTEXT_SIZE constant for error messaging.

This description was created by Ellipsis for cc84180. You can customize this summary. It will automatically update as commits are pushed.

The previous implementation added the `--no-context-shift` flag when `cfg.ctx_shift` was disabled, which conflicted with the llama.cpp CLI where the presence of `--context-shift` enables the feature.
The logic is updated to push `--context-shift` only when `cfg.ctx_shift` is true, ensuring the extension passes the correct argument and behaves as expected.
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 06fd2b8 in 1 minute and 4 seconds. Click for details.
  • Reviewed 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. extensions/llamacpp-extension/src/index.ts:1544
  • Draft comment:
    The fix correctly pushes '--context-shift' only when cfg.ctx_shift is true (omitting the flag disables the feature per the llama.cpp CLI). Consider adding an inline comment to clarify this behavior for future maintainers.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_HMTFjhEebD1fVAz3

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

github-actions bot commented Sep 12, 2025

Barecheck - Code coverage report

Total: 29.38%

Your code coverage diff: -0.01% ▾

✅ All code changes are covered

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed cc84180 in 1 minute and 27 seconds. Click for details.
  • Reviewed 45 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. extensions/llamacpp-extension/src/index.ts:1547
  • Draft comment:
    Good fix – now '--context-shift' is pushed only if cfg.ctx_shift is true, matching llama.cpp CLI behavior. Consider adding a brief inline comment for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. extensions/llamacpp-extension/src/index.ts:1747
  • Draft comment:
    Nice addition: checking if finish_reason === 'length' in the streaming response converts out‐of‐context conditions to a clear error. Consider extracting this duplicated error check into a helper function.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. extensions/llamacpp-extension/src/index.ts:1832
  • Draft comment:
    The non-streaming response now properly checks for finish_reason 'length' and throws an error. To reduce code duplication, consider refactoring this repeated logic into a shared function.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. extensions/llamacpp-extension/src/index.ts:1755
  • Draft comment:
    Typographical note: In the comment, 're‑throw' seems to be using a non-standard hyphen (possibly a non-breaking hyphen). Consider using a standard hyphen ('re-throw') for consistency.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_jXCIdRP7ZpTP3sLj

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@dinhlongviolin1 dinhlongviolin1 changed the title fix: correct context shift flag handling in LlamaCPP extension fix: correct context shift flag handling in LlamaCPP extension (#6404) Sep 12, 2025
@qnixsynapse qnixsynapse linked an issue Sep 12, 2025 that may be closed by this pull request
@qnixsynapse qnixsynapse merged commit 654e566 into release/v0.6.10 Sep 12, 2025
16 checks passed
@qnixsynapse qnixsynapse deleted the fix/context_shift branch September 12, 2025 08:13
@github-project-automation github-project-automation bot moved this to QA in Jan Sep 12, 2025
@github-actions github-actions bot added this to the v0.6.10 milestone Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: QA
Development

Successfully merging this pull request may close these issues.

bug: Truncate Input not working
2 participants