Skip to content

fix: triage batch (#699 Ctrl+D, #694 custom provider labels, #695 stale todo goals) - #701

Merged
1jehuang merged 5 commits into
masterfrom
agent/issue-699-ctrl-d
Aug 1, 2026
Merged

1jehuang merged 5 commits into
masterfrom
agent/issue-699-ctrl-d

Conversation

@1jehuang

@1jehuang 1jehuang commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Autonomous triage batch: three low-risk fixes from newly reported issues.

#699 Ctrl+D should delete a character, not exit the session

Ctrl+D was aliased to Ctrl+C in both the local and remote key handlers, so it quit whenever the app was idle. It now follows readline convention: forward-delete while the input line has text, interrupt/quit only on an empty line. Covered by tests/issue_699_ctrl_d_delete.rs (4 tests, including a multibyte case).

#694 Custom openai-compatible models tagged with a copilot prefix

Route resolution for bare model ids only consulted the built-in OpenAI-compatible profiles, never user-defined [providers.<name>] entries from config.toml. Custom models therefore matched no known provider and fell through to the Copilot heuristic, which labelled them Copilot and built an unresolvable copilot:<model> id. remote_openai_compatible_route_for_model now falls back to named config profiles, which also suppresses the bogus Copilot route (remote_model_should_offer_copilot_route reads through the same function).

Three tests, including one that writes a real config.toml with the reporter's omlx profile and asserts the full picker route set contains the profile route and no copilot route.

#695 Stale todos panel across tasks

merge_goals intentionally retains goals a write does not mention, but nothing pruned goals whose todo group had disappeared, so assessments from a finished task lingered in the panel. Orphaned goals are now dropped when the todo list no longer contains their group; goals-only writes and flat (ungrouped) lists are unaffected.

Four tests, including one that drives the real TodoTool end to end: complete task one, start task two, then assert the stored todos and goals describe task two only.

Verification

  • Both behavioural fixes were confirmed to fail their new end-to-end tests when the fix is temporarily reverted, so these are real regression guards rather than tests written to match the implementation.
  • cargo test -p jcode-base --lib (1214 passed), -p jcode-app-core --lib (todo suite green), -p jcode-tui --lib serially (2117 passed).
  • cargo clippy and guardrail ratchets clean for the touched files; size baselines rebaselined only for the lines this branch adds.
  • Also fixed a pre-existing red test, schema_advertises_intent_and_todos, which asserted a lowercase requirement-to-check against schema text that capitalises it.

--- — Jcode agent (automated triage), on behalf of @1jehuang

A trial that never reached the model measures nothing, so retry it with linear
backoff rather than letting a transient rate limit shrink the sample. The
comparison runner now takes a trial count and honors PROVIDER, since free-tier
providers throttle and budgeted ones run out mid-run.
…2k Ollama over-report it found

Adds tests/context_window_matrix.rs as a companion to provider_matrix.rs. The
provider matrix sweeps auth/endpoint state; this one sweeps how a context
window gets *resolved*, because that is where a specific recurring class of bug
lives (#403, #447, #541, #577, #578, and the Ollama truncation just fixed).

These bugs are all the same shape and all silent: one resolution source
disagrees with another, the wrong one wins, jcode over-budgets the request, and
the endpoint truncates without erroring. The user sees a model that "forgot"
the conversation while the context gauge still looks healthy. Per-provider unit
tests each covered their own case after the fact; this states the cross-cutting
invariants once so newly added providers inherit the guardrail:

- resolved windows are always plausible (never zero/absurd)
- configured/cached windows beat generic family fallbacks (#541 shape)
- resolution is deterministic (gauge and compaction budget cannot drift, #441)
- provider hints never silently *widen* a window (narrowing is legitimate)
- unknown models land on the declared default rather than something enormous
- a cache entry for an unrelated model id cannot leak into resolution (#403)

Each invariant was mutation-tested: reverting the corresponding fix makes the
matching test fail, so these are load-bearing rather than decorative.

That mutation testing exposed a real gap in the previous commit. Deleting the
cold-cache Ollama clamp still passed every test, and writing the missing
regression test revealed the clamp was ordered *below* the static open-weight
family table. That table is what actually reported 262144 for `qwen3:*` on
Ollama while the server served 4096, which is precisely the number the bug
report described. The clamp now outranks the static family table while still
losing to the live catalog and to an explicit per-model `context_window`, so a
user who raises OLLAMA_CONTEXT_LENGTH and declares the window is still
believed. Both directions are covered by tests.

Ollama context tests move to their own file so the already-oversized
openrouter_tests.rs does not keep growing.

Verified end to end: cold server reports 4096, and after a model loads with
OLLAMA_CONTEXT_LENGTH=16384 the catalog self-corrects to 16384.
@1jehuang
1jehuang merged commit 0501448 into master Aug 1, 2026
2 checks passed
@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes several low-risk behavior issues and adds tests around them. The main changes are:

  • Ctrl+D now forward-deletes text in local and remote TUI input instead of quitting while input is non-empty.
  • Custom OpenAI-compatible provider models now resolve through user-defined [providers.<name>] profiles.
  • Todo goals are pruned when their todo group no longer exists.
  • Ollama context-window resolution now prefers the conservative serving default before static family fallbacks.
  • Benchmark and donut verification scripts gained stricter retry and animation checks.
  • New regression and context-window matrix tests cover the updated behavior.

Confidence Score: 5/5

Safe to merge with minimal risk.

The changes are targeted and covered by focused tests. Reviewed control paths preserve the intended precedence and fallback behavior. No correctness or security issues were identified.

Files Needing Attention: No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex ran the Rust validation suite with the requested targeted filters and captured timestamped commands, working directory, cargo output, test counts, pass/fail lines, and exit codes into a log.
  • T-Rex confirmed all validation commands exited with code 0 and that the run stayed on the targeted filters, avoiding the unrelated schema_advertises_intent_and_todos failure.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
crates/jcode-tui/src/tui/app/input.rs Implements readline-style Ctrl+D forward-delete semantics for local input handling.
crates/jcode-tui/src/tui/app/remote/key_handling.rs Applies the same Ctrl+D forward-delete behavior to remote key handling before interrupt/quit fallback.
crates/jcode-base/src/provider/catalog_routes.rs Extends bare-model route resolution to user-defined OpenAI-compatible provider profiles.
crates/jcode-app-core/src/tool/todo.rs Adds pruning for retained todo goals whose groups no longer exist.
crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs Reorders context-window resolution so Ollama defaults outrank static family heuristics while live and explicit limits still win.
tests/context_window_matrix.rs Adds a hermetic context-window resolution suite covering precedence, determinism, defaults, and cache lookup behavior.
scripts/benchmark_discovery_rate.py Adds retry and backoff handling for invalid benchmark trials.
scripts/verify_donut_still_animates.py Forces idle animation on during verification and fails when the expected donut state is inactive.

Sequence Diagram

sequenceDiagram
participant User
participant TUI as Local/Remote TUI
participant Todo as TodoTool
participant Routes as Catalog routes
participant OR as OpenRouterProvider

User->>TUI: Ctrl+D
alt input has text and app is idle
    TUI->>TUI: forward-delete char under cursor
else empty input or processing
    TUI->>TUI: existing quit/interrupt behavior
end

User->>Todo: write todos/goals
Todo->>Todo: merge stored + incoming goals
Todo->>Todo: prune goals without live todo groups

User->>Routes: select bare custom model id
Routes->>Routes: check built-in OpenAI-compatible profiles
Routes->>Routes: "fallback to named [providers.<name>] models/default"
Routes-->>User: "openai-compatible:<name> route"

User->>OR: request context window
OR->>OR: live in-memory/disk catalog
OR->>OR: explicit static_context_limits
OR->>OR: Ollama conservative serving default
OR-->>User: resolved context budget
Loading

Reviews (1): Last reviewed commit: "test(context): add a context-window reso..." | Re-trigger Greptile

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.

1 participant