Skip to content

fix: triage batch (9 issues: #729, #728, #726, #724, #722, #719, #715, #712, #706) - #727

Merged
1jehuang merged 24 commits into
masterfrom
agent/triage-2026-08-02-clean
Aug 3, 2026
Merged

1jehuang merged 24 commits into
masterfrom
agent/triage-2026-08-02-clean

Conversation

@1jehuang

@1jehuang 1jehuang commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

Automated triage pass over the open issue backlog. Nine fixes, one commit each, every one with a verified root cause and regression coverage.

Issue Fix Commit
#726 dev_cargo.sh forced clang as the linker driver even in system mode, so builds failed with exit 101 without clang installed 9ecca3540
#724 claude-opus-5 missing from the subscription catalog while the live router advertised it for every paid tier e222069de
#706 Curated OAuth ScheduleWakeup schema had drifted from the real schedule tool, so every call failed with task is required for action=create 3e8cf17c7
#722 Curated OAuth Bash schema omitted justification, the destructive gate's own escape hatch 3e8cf17c7
#719 setup-hotkey injected global launch binds into a nested recent-windows binds node, breaking the whole niri config bd0de74ff
#715 spawn_in_new_terminal was a non-Unix no-op, so /judge, /fork, /review, /transfer and crash-restore never opened a window on Windows 9bcc8fe65
#712 auth-test --provider-profile <name> cleared the profile before probing, false-negativing every custom named profile 40ec8fe70
#728 Word-delete with an active selection left a stale anchor; the next Backspace panicked across winit's ObjC boundary and aborted the process 621a264b0
#729 Swarm-spawned workers were forced into isolated test-mode memory, so they could never see real project/global memory 3e8550913

Plus 1e4c50211, which fixes a CI blocker inherited from master (see below).

Follow-up hardening after a second verification pass, which found and closed three gaps:

Two recurring patterns worth a look

Hand-maintained copies drifting from their source (#706, #722). The Anthropic OAuth path hand-maintains curated tool schemas so the subscription endpoint sees Claude-Code builtin names. Those copies drift, and the drift is invisible until a model calls the tool and the handler rejects the arguments. ScheduleWakeup was 100% broken on subscription routes. Rather than correct the copy, this deletes it and forwards the real schema under the OAuth name, so the two cannot diverge again. Worth checking whether Agent, Read, Write, Edit, Glob, Grep and Skill have drifted the same way.

Comments describing a contract the code stopped honouring (#729). enable_memory_test_mode is documented "Called when session is marked as debug", but create_headless_session called it unconditionally, and that function is also the production path for real swarm workers.

Verification

  • jcode-base, jcode-provider-anthropic, jcode-setup-hints: 1359 passed
  • jcode lib: 207 passed. jcode-desktop2 editor: 62 passed
  • All 10 CI checks pass, including Build & Test on ubuntu, macOS and Windows, plus the Windows Cross-Target Check

Beyond unit tests, the three fixes with external dependencies were verified against the real thing:

Same fix-removal check for #728: both new tests fail on pre-fix code and pass after.

Inherited CI blocker, fixed here

Commit 05014482b on master added a jcode-provider-core dev-dependency without committing the regenerated lock file, so every job running cargo with --locked failed before compiling anything. Both Windows jobs were red on master for this. Refreshed in 1e4c50211 (one generated line, no version changes).

Known-failing gate

Quality Guardrails fails on the oversized-file, oversized-test and swallowed-error ratchets. Measured entry counts on a clean origin/master worktree versus this branch:

Ratchet clean master this PR
oversized-file 16 16
oversized-test 5 5
swallowed-error 7 7

Identical, so this PR contributes zero additional drift despite adding nine fixes and eight test modules. Tracked in #692, where I posted these figures.

Also filed #730: tool::todo::tests::schema_advertises_intent_and_todos fails on clean master, and CI's targeted cohorts do not run workspace unit tests, so it is currently invisible.

One baseline line moved (src/cli/provider_init.rs, 1831 -> 1836) for the #712 fix. No other baselines touched.

Scope notes

Credit to the reporters, who did most of the root-cause work: @MatrixMagician (#726), @caipira113 (#724), @rameshbaskaran (#706, #722), @tingfeng347 (#719), @rensburger (#715), @e-kotov (#712), @wtchronos (#728), @jonschull (#729).

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

…ixes #726)

The clang export sat before the mode dispatch, so it applied to `system`
mode too. On a machine without clang the script logged 'using system linker
settings' and then told cargo to invoke a linker that is not installed,
failing every build script with exit 101. Only mold and lld need clang as
the driver; system mode now leaves the choice to cargo's default cc.
The live router catalog authorizes claude-opus-5 for every paid tier, but
the client catalog omitted it, so `--model claude-opus-5` silently ran
claude-opus-4-8 instead. Added as a non-default entry; which model is the
default remains a separate decision.
… real tools

The OAuth endpoint expects Claude-Code builtin tool names, so a few schemas
are hand-maintained. Two had drifted:

- ScheduleWakeup advertised delaySeconds/reason/prompt while the real
  `schedule` handler requires `task` plus wake_in_minutes/wake_at, so every
  call failed with 'task is required for action=create'. Dropped the
  fabricated entry and let the real schema forward under the OAuth name, so
  the two stay in sync by construction (fixes #706).
- Bash omitted `justification`, the destructive gate's documented
  Confirm-tier escape hatch, leaving it discoverable only from an error
  string after a block (fixes #722).

Regressions live in oauth_tool_schema_tests.rs.
…#719)

binds_block_insert_point returned the first line that textually started with
`binds` and ended with `{`, ignoring KDL brace depth. In a split config with
a `recent-windows { binds { ... } }` node, the managed region landed there,
niri rejected the `spawn` action, and the whole config failed to load.

Insertion now skips nested binds nodes, and a managed block a previous
version wrote into one is relocated on the next run instead of being left
broken. Reported with a repro and a reference branch by @tingfeng347.
spawn_in_new_terminal was a hardcoded Ok(false) off Unix, so /judge, /fork,
/review, /autoreview, /autojudge, /transfer, batch crash-restore and remote
split responses all printed 'No terminal found' and never opened a window.
Everything below it was already Windows-capable: jcode-terminal-launch
detects Windows Terminal / Alacritty / WezTerm and falls back to
`cmd /C start`, and the session picker's resume already used it.

Dropping the cfg split routes every platform through that machinery.
Diagnosed with a reference branch by @rensburger.
…ixes #712)

apply_login_provider_profile_env unconditionally called
force_apply_openai_compatible_profile_env, which clears
JCODE_NAMED_PROVIDER_PROFILE. `auth-test --provider-profile <name>`
therefore probed the built-in generic openai-compatible slot and reported
not_configured for profiles that work fine for inference, sending users to
debug config that was never broken.

Named profiles now short-circuit, matching the precedence the explicit
`--provider <compatible>` path already applies. Diagnosed by @e-kotov.
@greptile-apps

greptile-apps Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a batch of issues across provider setup, tool schemas, terminal launch, editor selection handling, niri config insertion, and swarm memory behavior. The main changes are:

  • Adds claude-opus-5 to the curated subscription catalog as a non-default paid-tier model.
  • Forwards the real schedule schema for Anthropic OAuth ScheduleWakeup and adds justification to the curated Bash schema.
  • Keeps swarm-spawned headless sessions on real project/global memory while preserving isolated memory for debug admin sessions.
  • Removes the non-Unix no-op path for in-app terminal spawning and adds portable Windows launch coverage.
  • Fixes word-delete with active editor selections so stale anchors are cleared before the next edit.
  • Restricts niri hotkey insertion to top-level binds blocks and relocates older nested managed blocks.
  • Preserves named OpenAI-compatible profile labels in auth-test probing and reporting.
  • Stops forcing clang when dev_cargo.sh falls back to system linker mode.

Confidence Score: 5/5

This PR appears safe to merge.

The changed paths are targeted fixes with tests for the updated behavior. No new accepted issues remain from this review.

Files Needing Attention: No files require special attention beyond the existing niri raw-string thread.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the subscription catalog tests to validate contract behavior and capture results.
  • Saved the test log artifact documenting the results of the run.
  • Verified that the listed tests passed, with 11 passed and 0 failed on the full run and 1 passed and 0 failed on the targeted run.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
crates/jcode-app-core/src/server/comm_session.rs Marks swarm headless fallbacks as RealProject memory users so production workers keep access to project/global memory.
crates/jcode-app-core/src/server/headless.rs Replaces implicit memory test mode with an explicit memory scope enum at headless session creation.
crates/jcode-desktop2/src/editor.rs Makes word-delete operations consume active selections before deleting surrounding words, clearing stale anchors.
crates/jcode-provider-anthropic/src/lib.rs Forwards the real schedule tool schema under ScheduleWakeup and advertises Bash.justification in OAuth mode.
crates/jcode-setup-hints/src/linux_niri.rs Restricts niri hotkey insertion to top-level binds blocks, relocates older nested managed blocks, and adds parser/fuzz coverage.
crates/jcode-tui/src/tui/app/helpers.rs Removes the non-Unix spawn_in_new_terminal no-op so all platforms route through terminal launch.
scripts/dev_cargo.sh Stops forcing clang as the Linux linker driver when falling back to system linker mode.
src/cli/auth_test/choice.rs Labels named OpenAI-compatible profile auth-test reports with the selected profile name.

Sequence Diagram

sequenceDiagram
participant User
participant TUI as jcode TUI / commands
participant Launcher as terminal_launch
participant Headless as create_headless_session
participant Registry as Tool Registry
participant Memory as Project/Global Memory

User->>TUI: spawn worker / resume / auth-test / edit action
alt visible terminal spawn succeeds
    TUI->>Launcher: spawn_command_in_new_terminal(...)
    Launcher-->>TUI: Ok(true)
else visible spawn unavailable for swarm
    TUI->>Headless: create_headless_session(..., RealProject)
    Headless->>Registry: Registry::new(provider)
    Headless->>Memory: use real project/global memory
    Headless-->>TUI: new session id
end
alt debug admin session
    TUI->>Headless: create_headless_session(..., IsolatedTest)
    Headless->>Registry: enable_memory_test_mode()
end
Loading

Reviews (11): Last reviewed commit: "test(terminal-launch): move the portable..." | Re-trigger Greptile

0501448 added tests/context_window_matrix.rs with a jcode-provider-core
dev-dependency but did not commit the regenerated lock file, so every CI job
that runs cargo with --locked fails before compiling anything:

  error: cannot update the lock file ... because --locked was passed

This is one generated line; no dependency versions change.
@1jehuang

1jehuang commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

CI status

Fixed a blocker that predates this PR. Every job running cargo with --locked was failing before compiling anything:

error: cannot update the lock file ... because --locked was passed to prevent this

Commit 05014482b on master added tests/context_window_matrix.rs with a jcode-provider-core dev-dependency but did not commit the regenerated lock file. Windows Cross-Target Check and Build & Test (windows-latest) were red on master for this reason, not because of anything here. Refreshed in 1e4c50211 (one generated line, no version changes). Both Windows jobs now pass, which also gives real cross-compile validation of the #715 change.

Remaining failure is pre-existing. Quality Guardrails fails on the oversized-file, oversized-test and swallowed-error ratchets. Verified these are identical to clean master (checked against a fresh worktree), and confirmed in the CI log that no ratchet entry names any file touched by this PR. The named files are desktop2/transcript.rs, tui/ui.rs, app/input.rs, tool/todo.rs, provider/catalog_routes.rs and similar, all from other in-flight work. This is #692.

Passing: Format, Build & Test (ubuntu), Windows Cross-Target Check, PowerShell Syntax, Release Automation, Setup Friction Eval, Require Linked Issue, Greptile Review.

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

#719)

The unit tests assert where the managed block lands. Only niri itself can
confirm the result is a config it will actually load, which is the property
the reporter cared about: the old code produced output niri rejected outright.

Verified this test earns its keep: with the brace-depth check removed it fails
against real niri, and passes with it. Skips cleanly when niri is absent, so it
is a hard check on a niri machine and a no-op elsewhere.
delete_back/delete_forward consume a selection first, but delete_word_back
and delete_word_forward did not. A word-delete with an active selection
therefore shortened the buffer while leaving `anchor` pointing past the new
end. The next ordinary Backspace sliced out of bounds and panicked, and
because the panic crosses winit's Objective-C key_down boundary it aborted
the process rather than unwinding.

Reported with a deterministic repro (type 'hello world', Shift+Left,
Option+Backspace, Backspace) and the correct minimal fix by @wtchronos.

The two regression tests fail before this change and pass after it.
…ixes #729)

create_headless_session called enable_memory_test_mode() unconditionally,
even though its own doc comment says test mode is 'called when session is
marked as debug'. That function is also the production path for real
swarm-spawned workers, so every inline/headless worker got MemoryManager
{ test_mode: true }, and project_memory_path() then short-circuits to
~/.jcode/memory/test/ before ctx.working_dir is ever consulted.

The effect: a spawned worker could never read what the session that spawned
it remembered, and its own 'durable' writes went to throwaway storage. This
is distinct from #491 and #720, which fix working-dir scoping in paths that
never reach this override.

Isolation is now explicit per caller: debug-socket admin sessions opt in
(where isolation is the point), real swarm spawns opt out.

Diagnosed by @jonschull while verifying the #720 follow-up.
@1jehuang 1jehuang changed the title fix: triage batch (#726, #724, #722, #719, #715, #712, #706) fix: triage batch (9 issues: #729, #728, #726, #724, #722, #719, #715, #712, #706) Aug 2, 2026
Keeps editor.rs near the code-size budget, following this test directory's
stated 'split by concern so no file grows unbounded' rule.

Rebaselines the two entries the fixes genuinely grow: editor.rs (+9, the
selection guards) and comm_session.rs (+2, the new isolate_memory argument).
No other baselines touched.
Makes the severity of enabling memory test mode on a production path
explicit: a manager in test mode cannot see real project memory even when
handed the correct project directory, because project_memory_path()
short-circuits before the directory is consulted.

That is exactly what swarm-spawned workers were subjected to
unconditionally, so they could never read what the session that spawned
them remembered.
…715)

A cfg'd-out stub cannot be caught by tests that only run where it is absent,
which is why spawn_in_new_terminal could be a silent no-op on Windows for so
long. This asserts the checkable property instead: the function exists on
every target, and the launcher arguments it forwards are platform-neutral.

Verified it catches the regression: reintroducing the cfg(not(unix)) split
makes this test fail to build.
…ime slot (refs #712)

Named profiles run on the generic openai-compatible runtime, so the report
was headed 'auth-test: openai-compatible' and the credential probe said
'OpenAI-compatible auth status is ...' no matter which profile the user
selected. After the probe-target fix the verdict was correct but still not
attributable to a target, which is most of what made #712 confusing.

Both the header and the credential line now name the profile:

  === auth-test: company-gateway (openai-compatible profile) ===
  ✓ credential_probe — company-gateway auth status is available (...)

Builtin providers are unchanged, including while a profile is set. The
regression test fails if the label falls back to the runtime slot.
…#715)

The compile-time guard proves spawn_in_new_terminal exists on every target,
but not that a spawn happens. spawn_in_new_terminal short-circuits under
cfg!(test) so unit tests never pop real windows, so this drives the layer
immediately below that guard: the exact TerminalCommand the fixed function
builds, through the real launcher, with the configured spawn hook as the
injectable seam.

A recording hook script asserts the launcher both received the --resume
invocation and reported success. Verified sensitive: emptying the forwarded
args makes it fail with 'launcher never received the resume invocation'.
…729)

A bare bool at the call site is one typo away from silently reintroducing
#729, where every real swarm worker was forced into throwaway test storage
and could never read what the session that spawned it remembered. The
original bug was exactly this shape: an unconditional call whose intent was
documented only in a comment on the function it called.

The call sites now read:

  comm_session.rs        HeadlessMemoryScope::RealProject
  debug_session_admin.rs HeadlessMemoryScope::IsolatedTest

so the wrong one is hard to pick by accident and obvious in review.
The first version drove the configured spawn hook, which is resolved through
the process-wide cached config. It passed when run alone and failed in CI,
where an earlier test in the same binary had already loaded config, so the
hook override was never observed. That is a flaky test, which is worse than
no test.

Now it drives spawn_command_in_new_terminal_with directly, the injectable
seam the real path bottoms out in, and records what the spawner received. No
config, no env vars, no process spawning, so ordering cannot affect it.

Verified: passes standalone, in-module, and under --test-threads=1, and still
fails with 'launcher never received the resume invocation' when the forwarded
args are emptied.
@1jehuang

1jehuang commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Final CI state

All 10 platform and quality checks pass: Build & Test on ubuntu, macOS and Windows, plus Format, Windows Cross-Target Check, PowerShell Syntax, Release Automation, Setup Friction Eval, Require Linked Issue and Greptile Review.

Two things found and handled during verification, both worth recording:

1. One of my own new tests was flaky, and CI caught it. The first #715 behavioral test drove the configured spawn hook, which resolves through the process-wide cached config. It passed standalone and failed in CI, where an earlier test in the same binary had already loaded config. Rewritten in 804d93e63 to drive spawn_command_in_new_terminal_with directly, the injectable seam the real path bottoms out in: no config, no env vars, no process spawning, so ordering cannot affect it. Verified passing standalone, in-module, and under --test-threads=1, and still failing when the forwarded args are emptied.

2. A pre-existing macOS flake, not from this PR. reload_notifies_clients_across_independent_sessions failed once, having passed twice earlier on this same branch. Diagnosed to root cause and filed as #731: get_history_event skips only Ack, so a racing SwarmStatus broadcast gets returned as if it were the history reply. Confirmed by re-running the job with no code change: it passes.

Remaining red gate is inherited. Measured entry counts, clean origin/master worktree versus this branch: oversized-file 16/16, oversized-test 5/5, swallowed-error 7/7. Identical, so this PR adds zero drift despite nine fixes and eight new test modules. Tracked in #692.

Also filed #730 (a jcode-app-core unit test failing on clean master, invisible because CI runs targeted cohorts rather than workspace unit tests).

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

… node (refs #719)

The depth scanner added for #719 only understood `//` line comments. KDL also
has `/* */` block comments, which may contain *unbalanced* braces, and real
niri accepts that. A single stray `{` in a comment therefore made every
following node look nested, so the genuine top-level `binds` node was skipped
and a duplicate one appended.

Found by probing real niri for constructs the scanner had not been written
against, rather than re-testing what it already handled. The original fix was
verified only against configs I had thought of.

The real-niri test now sweeps four shapes: nested compositor binds,
unbalanced braces in a block comment, a brace inside a quoted string, and a
config with no binds node. Verified all of it catches the regression: removing
block-comment handling fails both the unit test and the real-niri sweep.
…efs #719)

Extends the real-niri sweep to six shapes, adding two KDL string forms the
depth scanner had not been checked against: an escaped quote followed by a
brace, and a raw string (r#"..."#) where a backslash is not an escape and the
content ends with a backslash before the closing delimiter.

Both are accepted by real niri, and both are now confirmed to leave the
insert point correct.
The reported bug was one method forgetting to clear `anchor`, and it only
surfaced on the *next* keystroke. Two targeted tests cover the two reported
methods; this checks the invariant across every mutating operation, four
selection shapes and four buffers including multibyte text, then drives one
further edit because that is where the panic actually landed.

Verified it rediscovers the original defect independently: removing the fix
fails with 'delete_word_back after extend_left on "hello world": stale
selection 6..11 over "hello d"', which is the reporter's exact buffer state.
…#719)

Hand-written cases are how the block-comment bug survived the first fix: they
only cover constructs I had already thought of. This uses niri itself as the
oracle instead.

The generator emits random KDL built from constructs that stress a brace
scanner (block comments with unbalanced braces, nested and multiline block
comments, /- slashdash nodes, line comments ending in a brace, quoted and raw
strings, nested compositor binds), keeps only configs real niri accepts, and
the test asserts each still validates after jcode splices its block in.

550-case corpus committed for a hermetic ~3s test. Beyond it, ~2400 configs
across five independent seeds were run out-of-band with no failures.

Verified the corpus earns its keep: removing block-comment handling fails with
'niri rejected a spliced config that it accepted before'.
…y (refs #729)

The existing coverage was structural: it pinned that test mode ignores the
project dir, and the call sites now name their choice. Neither actually
executes the tool, which is what the reporter did.

This drives Tool::execute end to end: a spawning session records a
project-scoped memory, then a worker with real memory (the fixed path) must
see it, and a worker in test mode (the pre-fix path) must not. Driving the
tool rather than inspecting a flag keeps it honest across refactors.

Verified sensitive: switching the worker back to test mode fails with
'a swarm worker must see the spawning session's project memory, got: No
memories stored', which is the exact symptom reported.
… (refs #715)

The Windows spawn tests in this crate are all cfg(not(unix)), so none of them
run in this repo's Linux CI or on a Linux dev box. That is the same blind spot
that let the in-app spawn stub sit unnoticed off Unix in the first place.

windows_command_line is compiled under cfg(test) on every platform, so pin the
resume invocation where it will actually be exercised: a program path
containing a space must be quoted (or cmd.exe would run 'C:\\Program'), and
safe arguments must not be needlessly quoted.

Verified sensitive: replacing the quoting with a plain join fails with
'unquoted program path would break on a default Windows install'.
Keeps lib.rs near its budget and gives the platform-independent Windows
checks an obvious home, with a module doc explaining why they exist: the
cfg(not(unix)) tests beside them never run in this repo's Linux CI, which is
the blind spot that hid #715.

One baseline line moves (1216 -> 1219) for the module declaration itself.
@1jehuang
1jehuang merged commit 30de2a2 into master Aug 3, 2026
10 of 11 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.

1 participant