Skip to content

fix: normalize Casper CLI ranking and Windows UTF-8 - #3

Merged
Grar00t merged 5 commits into
mainfrom
fix/casper-runtime-ranking-utf8-20260907
Sep 7, 2026
Merged

Grar00t merged 5 commits into
mainfrom
fix/casper-runtime-ranking-utf8-20260907

Conversation

@Grar00t

@Grar00t Grar00t commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Fixes the runtime behavior observed in the Windows CLI:

  • force UTF-8 console code pages on Windows
  • defensively sort emitted RAG sources by score before answer selection/output
  • unwrap DuckDuckGo redirect URLs to their actual destination
  • expose relevance_score, preserve confidence as an explicit top lexical relevance alias, and add mean_relevance
  • add --self-check covering ranking, answer-source selection, and DDG URL normalization
  • run the self-check under GCC and Clang CI

Baseline: 8109cb2

Copilot AI lite review requested due to automatic review settings September 7, 2026 09:16
@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
casper Ready Ready Preview, v0 Sep 7, 2026 9:18am UTC
casper-7z Ready Ready Preview, v0 Sep 7, 2026 9:18am UTC
casper-nl Ready Ready Preview, v0 Sep 7, 2026 9:18am UTC

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deployment failed for project casper-nl with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/gratechs-projects?upgradeToPro=build-rate-limit

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deployment failed for project casper with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/gratechs-projects?upgradeToPro=build-rate-limit

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new CLI normalization introduces a couple of correctness/API consistency issues (notably bounds defensiveness and URL normalization affecting emitted hashes / schema stability) that should be addressed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the Casper C CLI to make Windows console output reliably UTF-8 and to make RAG result ordering/destination URLs deterministic at the CLI boundary, and it extends CI to run a new CLI self-check to catch regressions.

Changes:

  • Force UTF-8 console code pages on Windows and add --self-check for ranking / answer selection / DDG URL normalization.
  • Normalize DuckDuckGo redirect URLs and defensively re-sort results in the CLI before selecting/emitting sources.
  • Run the CLI self-check in CI after the generic smoke build.
File summaries
File Description
Core_CPP/casper_cli.c Adds Windows UTF-8 console configuration, DDG redirect URL unwrapping, defensive CLI-side result normalization/sorting, updated JSON fields, and a --self-check mode.
.github/workflows/ci.yml Runs ./build/casper --self-check after the smoke build for the C job matrix.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Core_CPP/casper_cli.c
Comment thread Core_CPP/casper_cli.c
Comment thread Core_CPP/casper_cli.c
@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deployment failed for project casper-7z with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/gratechs-projects?upgradeToPro=build-rate-limit

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deployment failed for project casper-7z with the following error:

Resource is limited - try again in 1 day (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/gratechs-projects?upgradeToPro=build-rate-limit

Grar00t commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

@copilot review

Addressed the three findings: clamp n_results, re-hash normalized URL+snippet before emission, and keep the no-results/error JSON schema consistent. Also replaced POSIX strnlen with a C11-local bounded length helper.

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown

@copilot review

Addressed the three findings: clamp n_results, re-hash normalized URL+snippet before emission, and keep the no-results/error JSON schema consistent. Also replaced POSIX strnlen wi...

Verified on 24a07a3: n_results is clamped in normalize_results, DDG URL normalization is followed by re-hashing of emitted url+snippet, and no-results/allocation-failure JSON keeps confidence, confidence_kind, and mean_relevance. I also ran bash scripts/build.sh --arch generic --smoke and ./build/casper --self-check, both passing.

@Grar00t
Grar00t force-pushed the fix/casper-runtime-ranking-utf8-20260907 branch from 9557b4a to 24a07a3 Compare September 7, 2026 09:25
@Grar00t
Grar00t merged commit 7da5605 into main Sep 7, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants