mirror of
https://github.com/codewhale-hq/Codewhale.git
synced 2026-11-09 17:10:44 -10:00
Merge PR #6696 (fix/first-run-configured-route-e2e) into integrate/0.10.1
This commit is contained in:
commit
776e3fee9f
4 files changed
+77
-6
No files matched your search
+6
-3
@@ -161,9 +161,12 @@ quieter, and Fleet runs can be checked before they spend anything.
|
||||
first launch is still detected. Usable configured routes skip the provider
|
||||
picker and record the provider step as configured, without claiming a
|
||||
successful check; missing-key recovery focuses the configured provider even
|
||||
on a fresh home. Empty sessions no longer show a full context
|
||||
window from the startup prompt; a submitted first turn or reported usage
|
||||
still shows real pressure.
|
||||
on a fresh home. Switching from that recovery picker (or after Esc) to a
|
||||
provider that has its key clears the launch "needs a key" state, so the
|
||||
footer names the route instead of "model not connected" and a detected local
|
||||
Ollama can no longer take over the provider just chosen. Empty sessions no
|
||||
longer show a full context window from the startup prompt; a submitted first
|
||||
turn or reported usage still shows real pressure.
|
||||
- `/trust on|off` changes file-tool trust for this session. Add `--save` to
|
||||
persist workspace trust for project skills, commands, hooks, MCP servers,
|
||||
and project context. Skipped-skill notices stay out of conversation titles
|
||||
|
||||
@@ -161,9 +161,12 @@ quieter, and Fleet runs can be checked before they spend anything.
|
||||
first launch is still detected. Usable configured routes skip the provider
|
||||
picker and record the provider step as configured, without claiming a
|
||||
successful check; missing-key recovery focuses the configured provider even
|
||||
on a fresh home. Empty sessions no longer show a full context
|
||||
window from the startup prompt; a submitted first turn or reported usage
|
||||
still shows real pressure.
|
||||
on a fresh home. Switching from that recovery picker (or after Esc) to a
|
||||
provider that has its key clears the launch "needs a key" state, so the
|
||||
footer names the route instead of "model not connected" and a detected local
|
||||
Ollama can no longer take over the provider just chosen. Empty sessions no
|
||||
longer show a full context window from the startup prompt; a submitted first
|
||||
turn or reported usage still shows real pressure.
|
||||
- `/trust on|off` changes file-tool trust for this session. Add `--save` to
|
||||
persist workspace trust for project skills, commands, hooks, MCP servers,
|
||||
and project context. Skipped-skill notices stay out of conversation titles
|
||||
|
||||
@@ -719,6 +719,15 @@ pub(crate) async fn switch_provider(
|
||||
|| previous_identity != target_identity
|
||||
|| previous_model != new_model;
|
||||
app.set_provider_identity_record(target_identity_record);
|
||||
// Launch computed "needs a key" for the launch provider. A switch to a
|
||||
// route that has its credential answers that, even when the user left the
|
||||
// picker with Esc first; otherwise the stale flag keeps the info line on
|
||||
// "model not connected" and keeps local-Ollama adoption armed against the
|
||||
// provider the user just chose. An auth-failure rollback restores it.
|
||||
app.onboarding_needs_api_key = !crate::config::has_api_key(config);
|
||||
if !app.onboarding_needs_api_key {
|
||||
app.onboarding_missing_key_recovery = false;
|
||||
}
|
||||
app.billing_presentation = crate::route_billing::for_route(config, target);
|
||||
app.max_subagents = config
|
||||
.max_subagents_for_provider(target)
|
||||
|
||||
@@ -10513,6 +10513,7 @@ fn first_run_route_context_keeps_reported_usage_without_messages() {
|
||||
|
||||
fn first_run_route_env_guards() -> Vec<crate::test_support::EnvVarGuard> {
|
||||
[
|
||||
"CODEWHALE_PROVIDER",
|
||||
"CODEWHALE_MODEL",
|
||||
"DEEPSEEK_MODEL",
|
||||
"CODEWHALE_BASE_URL",
|
||||
@@ -10623,6 +10624,61 @@ async fn first_run_route_endpoint_only_keeps_route_when_credentials_are_missing(
|
||||
}
|
||||
}
|
||||
|
||||
/// Launch through a keyless route (here an inherited `CODEWHALE_PROVIDER` /
|
||||
/// `CODEWHALE_MODEL` pair outranks the file's keyed `openai` route), leave the picker with Esc, then
|
||||
/// `/provider openai`. The switch lands on a route that has its key, so the
|
||||
/// launch-time "needs a key" state must not survive it: the info line would
|
||||
/// keep saying "model not connected" and local Ollama would stay armed to
|
||||
/// take over the route the user just chose.
|
||||
#[tokio::test]
|
||||
async fn first_run_switch_to_keyed_route_clears_launch_missing_key_state() {
|
||||
use crate::test_support::EnvVarGuard;
|
||||
|
||||
let _home = SettingsHomeGuard::new();
|
||||
let _env = first_run_route_env_guards();
|
||||
let _provider = EnvVarGuard::set("CODEWHALE_PROVIDER", "deepseek");
|
||||
let _model = EnvVarGuard::set("CODEWHALE_MODEL", "deepseek-v4-flash");
|
||||
let path = crate::config::home_config_path().unwrap();
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
std::fs::write(
|
||||
&path,
|
||||
"provider = \"openai\"\n\
|
||||
default_text_model = \"gpui-fixture\"\n\
|
||||
[providers.openai]\n\
|
||||
api_key = \"sk-fixture-0000000000000000000000000000\"\n\
|
||||
base_url = \"http://127.0.0.1:4880/v1\"\n",
|
||||
)
|
||||
.unwrap();
|
||||
let mut config = Config::load(None, None).expect("load configured route");
|
||||
let mut options = create_test_options();
|
||||
options.model = config.default_model();
|
||||
let mut app = App::new(options, &config);
|
||||
assert_eq!(app.api_provider, ApiProvider::Deepseek);
|
||||
assert!(app.onboarding_needs_api_key);
|
||||
assert!(app.onboarding_missing_key_recovery);
|
||||
assert_eq!(app.onboarding, OnboardingState::Provider);
|
||||
app.onboarding = OnboardingState::None;
|
||||
|
||||
let mut engine = mock_engine_handle();
|
||||
assert!(
|
||||
switch_provider(
|
||||
&mut app,
|
||||
&mut engine.handle,
|
||||
&mut config,
|
||||
ApiProvider::Openai,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
);
|
||||
|
||||
assert_eq!(app.api_provider, ApiProvider::Openai);
|
||||
assert!(!app.onboarding_needs_api_key);
|
||||
assert!(!app.onboarding_missing_key_recovery);
|
||||
assert!(!crate::local_ollama::should_adopt_live_local_ollama(
|
||||
&mut app
|
||||
));
|
||||
}
|
||||
|
||||
/// A key supplied only through the environment is a working hosted route:
|
||||
/// no onboarding, no local takeover.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user