Salvage: OpenRouter attribution headers and honest --mobile help - #6609
Merged
Merged
Conversation
Salvaged from the closed tui-redesign branch (PR #6222), commit 8299b3e4, which applies cleanly to main. We already sent `HTTP-Referer` and `X-Title`. `X-OpenRouter-Title` is the header OpenRouter documents today; `X-Title` is kept for backwards compatibility with OpenRouter-compatible gateways behind a base-URL override. `X-OpenRouter-Categories` was not sent at all; it now claims `cli-agent,personal-agent` (max two per request; unrecognised values are dropped silently, so the test pins the exact strings). `HTTP-Referer` stays `https://codewhale.net`, the app's identifier. The four-category rotation from fa4911d7 is not ported (it conflicts with main and is optional). CARGO_BUILD_JOBS=4 scripts/dev-cargo.sh test -p codewhale-tui --lib \ openrouter_routes_carry_app_attribution 1 passed, 0 failed Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Salvaged from the closed tui-redesign branch (PR #6222), commits 296fc88c and 98f290d6. The constant-time compare part of 296fc88c is dropped; #6601 covers it. --mobile help: `codewhale app-server --help` and the forwarded serve options claimed "--mobile defaults to 0.0.0.0" / "(binds 0.0.0.0)" and that --mobile with no host binds 0.0.0.0 for LAN access. The code does the opposite: `resolve_serve_bind_host` (crates/tui/src/lib.rs) ignores `mobile` and defaults to 127.0.0.1, and runtime_api.rs rejects a non-loopback mobile bind. The help, the `--host` doc comment, a stale test comment, and the same claim in docs/rfcs/REMOTE_SETUP_DESIGN.md now say what the code does. The remaining 0.0.0.0 literals in crates/cli/src/lib.rs are a parse test of an explicit `app-server --host 0.0.0.0` (mobile: false), which is still valid. deny.toml: the windows-* family was skipped unpinned, so any new duplicate passed silently. Now pinned to the versions cargo-deny actually encounters. The 0.42.x pins from the original commit are omitted: cargo-deny reports them as unmatched skips on this tree. CARGO_BUILD_JOBS=4 scripts/dev-cargo.sh test -p codewhale-cli --lib 405 passed, 0 failed target/debug/codewhale app-server --help no 0.0.0.0; says loopback-only cargo deny check bans bans ok; warning set identical before/after check-blocking-calls-budget, check-dead-code-budget, check-command-crate-boundaries, split/module_graph.py --check, cargo fmt --all -- --check all pass Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A user who set only the legacy `X-Title` in extra headers kept `X-OpenRouter-Title: Codewhale` on the request, so OpenRouter (which prefers the current header) would still show "Codewhale" rather than their name. Resolve one title up front -- user's X-OpenRouter-Title, else user's X-Title, else "Codewhale" -- and send it on both headers. The override test now asserts both headers follow a user title set on either name, and non-OpenRouter routes get no x-openrouter-title. Tests: scripts/dev-cargo.sh test -p codewhale-tui --lib client::tests:: 212 passed, 0 failed. cargo fmt --check, blocking-calls, dead-code, command-crate-boundaries and module_graph --check all pass. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages two small pieces from the closed tui-redesign branch (#6222).
OpenRouter attribution (8299b3e4, clean cherry-pick). OpenRouter routes now send
X-OpenRouter-Title: Codewhalenext to the legacyX-Title, plusX-OpenRouter-Categories: cli-agent,personal-agent.HTTP-Refereris unchanged. Other providers get none of these headers, and a user-configured header with the same name still wins.Accurate
--mobilehelp (296fc88c + 98f290d6, help and docs only). The CLI help said--mobilebinds0.0.0.0. The code does the opposite:resolve_serve_bind_hostdefaults to127.0.0.1and ignoresmobile, andruntime_apirejects a non-loopback mobile bind. This PR fixes the help, the--hostdoc comment, a stale test comment, anddocs/rfcs/REMOTE_SETUP_DESIGN.md. The0.0.0.0literals left incrates/cli/src/lib.rsbelong to a parse test of an explicitapp-server --host 0.0.0.0without--mobile, which is still correct.deny.toml: the
windows-*skips are now pinned to the versions cargo-deny actually sees, so a new duplicate gets flagged. The 0.42.x pins from the original commit are left out because they show up as unmatched skips on this tree.Not ported:
Verification:
scripts/dev-cargo.sh test -p codewhale-tui --lib openrouter_routes_carry_app_attribution: 1 passed, 0 failedscripts/dev-cargo.sh test -p codewhale-cli --lib: 405 passed, 0 failedtarget/debug/codewhale app-server --help: prints the loopback-only text and no0.0.0.0cargo deny check bans: bans ok, with the same warning set before and after--check, andcargo fmt --checkall passNo-Issue: salvage of closed PR #6222 (triage packet SALV-1); no tracking issue exists.
🤖 Generated with Claude Code