Skip to content

Accept set_route as model switch alias#296

Open
1jehuang wants to merge 11 commits into
masterfrom
fix-set-route-model-alias
Open

Accept set_route as model switch alias#296
1jehuang wants to merge 11 commits into
masterfrom
fix-set-route-model-alias

Conversation

@1jehuang

@1jehuang 1jehuang commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • accept legacy set_route requests as an alias for set_model
  • keep serializing model switch requests as set_model
  • add a regression test for set_route deserialization

Fixes #295

Test plan

  • cargo test -p jcode-protocol test_set_route_deserializes_as_set_model_compat_alias
  • rustfmt --check crates/jcode-protocol/src/wire.rs crates/jcode-protocol/src/protocol_tests/misc_events.rs
  • selfdev build / scripts/dev_cargo.sh build --profile selfdev -p jcode --bin jcode

1jehuang added 11 commits June 11, 2026 17:02
Add a native macOS menu bar (NSStatusItem) indicator launched via
`jcode menubar` that shows live counts of running jcode sessions and how
many are actively streaming a model response, e.g. "⚡2 · 5 sessions".

- Extend the active_pids registry with per-session streaming markers and a
  StreamingGuard RAII type; wire it into both streaming turn loops so the
  marker is set/cleared on every exit path.
- Add session::session_counts() which scans active_pids/ and streaming_pids/,
  skipping stale entries whose owning PID is dead.
- Implement `jcode menubar` (objc2/AppKit NSStatusItem with a 1s refresh
  timer); `--once`/`--json` print counts for scripting and non-macOS.
- Tests for counting logic, stale-pid handling, the guard, and title/summary
  formatting.
…n macOS

- Change the menu bar title format to the literal 'N streaming M sessions'
- Auto-spawn a singleton background 'jcode menubar' helper on macOS session
  startup so the indicator shows up for every macOS user without running the
  command manually (opt out via JCODE_NO_MENUBAR)
OpenAI's is_retryable_error maintained its own narrower allowlist that
omitted TLS-level transport failures (received fatal alert: BadRecordMac,
connection aborted, DNS errors, etc.). Unlike Anthropic/Claude/Copilot/
OpenRouter, which all delegate to the shared is_transient_transport_error,
OpenAI surfaced these transient failures to the user immediately
(attempt=1, will_retry=false) instead of retrying.

Delegate to the shared classifier and add regression test coverage.
…ation layer

Split default keybindings into two explicit per-platform lists (macOS vs
Windows/Linux) instead of one shared list plus runtime translation.

Each default now records how it was chosen:
- Dev: a developer explicitly chose it for the platform
- Ai: an AI agent chose it
- Automatic: derived programmatically (e.g. auto-translated)

Add a check layer (validate_keybinding_defaults) that warns when the two
lists drift apart: bound on one platform but missing on the other, or an
auto-translated default whose counterpart was an explicit choice (so it can
be confirmed or fixed). Warnings are logged once at startup.

KeybindingsConfig::default() now resolves each field from the registry for
the current platform.
Cmd+K / Cmd+J (vim-style) now jump between previous/next user prompts on
macOS terminals that forward Command as Super/Meta, instead of falling
through to line scrolling. The scroll fallbacks are cleared by default so
the keys are free for prompt navigation, and Cmd/Super+Backspace now
deletes the previous word rather than the whole input line. Updates tips,
help overlay text, and tests accordingly.
On macOS, Cmd+Right is reported by some terminals as Ctrl+E (end-of-line),
which unexpectedly opened $EDITOR (vi) over the TUI. Drop the external
editor feature and restore the standard readline Ctrl+E behavior (move
cursor to end of input).
Adds a SleepGuard RAII wrapper around an IOKit PreventUserIdleSystemSleep
power assertion (same mechanism as caffeinate -i). The TUI run loops
(local and remote) sync the guard with is_processing(), so the machine
stays awake while jcode is streaming and the assertion is released as
soon as the turn finishes. Opt out with JCODE_DISABLE_SLEEP_GUARD=1.

Validated by a unit test that checks pmset -g assertions while the
guard is held and after drop.
@1jehuang 1jehuang force-pushed the fix-set-route-model-alias branch from 9db7980 to 1252aaf Compare June 12, 2026 00:44
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.

Accept set_route compatibility alias for model switching

1 participant