Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable Phonton CLI release changes should be documented here.

This project follows pre-1.0 SemVer: minor versions may still include breaking changes while the public API and CLI surface settle.

## 0.4.5 - Provider Config Panic Fix

### Fixed

- Goal runs no longer panic when the selected provider cannot build a run configuration, such as Cloudflare without an Account ID or Workers AI base URL.
- The TUI now marks the goal failed with an actionable provider setup message instead of tearing down the terminal.
- Real worker dispatch now derives per-tier provider configs from a validated template, preserving custom endpoints while still honoring configured models.

## 0.4.4 - Shadow Logo Restore

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="assets/readme/phonton-cli-logo.png" width="112" alt="Phonton CLI logo">
</p>

<h1 align="center">Phonton CLI · v0.4.4</h1>
<h1 align="center">Phonton CLI · v0.4.5</h1>

<p align="center">
<strong>Verified code changes with repo memory.</strong><br>
Expand All @@ -12,7 +12,7 @@
<p align="center">
<a href="https://github.com/phonton-dev/phonton-cli/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/phonton-dev/phonton-cli/actions/workflows/ci.yml/badge.svg"></a>
<a href="https://github.com/phonton-dev/phonton-cli/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/phonton-dev/phonton-cli?style=flat&label=stars"></a>
<img alt="release" src="https://img.shields.io/badge/release-v0.4.4-6c63ff">
<img alt="release" src="https://img.shields.io/badge/release-v0.4.5-6c63ff">
<img alt="license" src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue">
<img alt="status" src="https://img.shields.io/badge/status-public_alpha-f97316">
</p>
Expand Down Expand Up @@ -103,7 +103,7 @@ Windows PowerShell:
Direct Cargo install:

```bash
cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.4.4 phonton-cli --locked --force
cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.4.5 phonton-cli --locked --force
```

Check the install:
Expand All @@ -119,7 +119,7 @@ Phonton uses GitHub branches and releases as install channels:

| Channel | Install | Use when |
|---|---|---|
| Stable | `cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.4.4 phonton-cli --locked --force` | You want the best validated public alpha |
| Stable | `cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.4.5 phonton-cli --locked --force` | You want the best validated public alpha |
| Dev | `cargo install --git https://github.com/phonton-dev/phonton-cli --branch dev phonton-cli --locked --force` | You want next-release integration changes |
| Nightly | `cargo install --git https://github.com/phonton-dev/phonton-cli --branch nightly phonton-cli --locked --force` | You want daily snapshots and can tolerate breakage |
| Main | `cargo install --git https://github.com/phonton-dev/phonton-cli --branch main phonton-cli --locked --force` | You want the current release branch tip |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phonton-cli",
"version": "0.4.4",
"version": "0.4.5",
"description": "Local-first agentic development terminal with context packs, source handles, and verification gates.",
"license": "MIT OR Apache-2.0",
"homepage": "https://github.com/phonton-dev/phonton-cli#readme",
Expand Down
2 changes: 1 addition & 1 deletion phonton-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "phonton-cli"
version = "0.4.4"
version = "0.4.5"
edition.workspace = true
license.workspace = true
repository.workspace = true
Expand Down
140 changes: 131 additions & 9 deletions phonton-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3736,6 +3736,60 @@ fn make_api_provider_config(
}
}

fn provider_config_failure_message(name: &str) -> String {
match name {
"cloudflare" => concat!(
"Cloudflare requires an Account ID or full Workers AI base URL. ",
"Set Account ID in Settings or set CLOUDFLARE_ACCOUNT_ID."
)
.into(),
"custom" | "openai-compatible" => {
"OpenAI-compatible providers require a Base URL in Settings.".into()
}
other => format!("Unknown provider `{other}`."),
}
}

fn provider_config_with_model(template: &ApiProviderConfig, model: String) -> ApiProviderConfig {
match template {
ApiProviderConfig::Anthropic { api_key, .. } => ApiProviderConfig::Anthropic {
api_key: api_key.clone(),
model,
},
ApiProviderConfig::OpenAI { api_key, .. } => ApiProviderConfig::OpenAI {
api_key: api_key.clone(),
model,
},
ApiProviderConfig::OpenRouter { api_key, .. } => ApiProviderConfig::OpenRouter {
api_key: api_key.clone(),
model,
},
ApiProviderConfig::Gemini { api_key, .. } => ApiProviderConfig::Gemini {
api_key: api_key.clone(),
model,
},
ApiProviderConfig::Ollama { base_url, .. } => ApiProviderConfig::Ollama {
base_url: base_url.clone(),
model,
},
ApiProviderConfig::AgentRouter { api_key, .. } => ApiProviderConfig::AgentRouter {
api_key: api_key.clone(),
model,
},
ApiProviderConfig::OpenAiCompatible {
name,
api_key,
base_url,
..
} => ApiProviderConfig::OpenAiCompatible {
name: name.clone(),
api_key: api_key.clone(),
model,
base_url: base_url.clone(),
},
}
}

/// Smoke-test a provider configuration end-to-end.
///
/// Builds the provider via `make_api_provider_config_with_url`, issues a
Expand Down Expand Up @@ -5379,20 +5433,44 @@ async fn spawn_goal(
// dispatch tried `gemini-2.5-flash`. Test/Ask used the configured
// model and worked; goals didn't, and the gap was invisible.
let configured_model = cfg.provider.model.clone();
let validation_model = configured_model.clone().unwrap_or_else(|| {
phonton_providers::model_for_tier(&provider_name, phonton_types::ModelTier::Cheap)
});
let Some(provider_template) = make_api_provider_config(
&provider_name,
api_key.clone(),
validation_model,
account_id,
base_url,
) else {
let reason = provider_config_failure_message(&provider_name);
let failed = GlobalState {
task_status: TaskStatus::Failed {
reason: reason.clone(),
failed_subtask: None,
},
goal_contract: plan.goal_contract.clone(),
handoff_packet: None,
active_workers: Vec::new(),
tokens_used: 0,
tokens_budget: None,
estimated_naive_tokens: plan.naive_baseline_tokens,
checkpoints: Vec::new(),
};
if let Ok(g) = store.lock() {
let _ = g.upsert_task(task_id, &text, &failed.task_status, 0);
}
let _ = tx
.send(LoopEvent::StateUpdate(goal_index, Box::new(failed)))
.await;
return;
};

let factory = move |tier: phonton_types::ModelTier| {
let model = configured_model
.clone()
.unwrap_or_else(|| phonton_providers::model_for_tier(&provider_name, tier));
let provider_cfg = make_api_provider_config(
&provider_name,
api_key.clone(),
model,
account_id.clone(),
base_url.clone(),
)
.expect("unknown provider config");
provider_for(provider_cfg)
provider_for(provider_config_with_model(&provider_template, model))
};

let guard = ExecutionGuard::new(working_dir.clone());
Expand Down Expand Up @@ -5866,6 +5944,50 @@ fn extract_id(line: &str) -> Option<String> {
}
}

#[test]
fn cloudflare_without_account_reports_config_failure() {
let cfg = make_api_provider_config(
"cloudflare",
"cf-token".into(),
"@cf/moonshotai/kimi-k2.6".into(),
None,
None,
);
assert!(cfg.is_none());
assert!(provider_config_failure_message("cloudflare").contains("Account ID"));
}

#[test]
fn provider_config_template_replaces_model_without_losing_endpoint() {
let template = make_api_provider_config(
"cloudflare",
"cf-token".into(),
"@cf/moonshotai/kimi-k2.6".into(),
Some("abc123".into()),
None,
)
.expect("cloudflare template should build from account id");

let updated = provider_config_with_model(&template, "tier-model".into());
match updated {
ApiProviderConfig::OpenAiCompatible {
name,
api_key,
model,
base_url,
} => {
assert_eq!(name, "cloudflare");
assert_eq!(api_key, "cf-token");
assert_eq!(model, "tier-model");
assert_eq!(
base_url,
"https://api.cloudflare.com/client/v4/accounts/abc123/ai/v1"
);
}
other => panic!("unexpected provider config: {other:?}"),
}
}

#[test]
fn typing_a_goal_appends_to_buffer() {
let mut app = App::default();
Expand Down
19 changes: 19 additions & 0 deletions release-notes/v0.4.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Phonton CLI v0.4.5

Phonton CLI 0.4.5 fixes a goal-run panic in provider configuration.

## Changes

- [fix] Prevent a TUI crash when a goal run starts with an incomplete provider configuration.
- [fix] Cloudflare without an Account ID or full Workers AI base URL now fails the goal with a setup message instead of panicking at `unknown provider config`.
- [fix] Worker dispatch now builds per-tier provider configs from a validated template, preserving Cloudflare/custom endpoints and configured models.

## Verification

- `cargo fmt --all -- --check`
- `cargo test --locked -p phonton-cli cloudflare_without_account_reports_config_failure`
- `cargo test --locked -p phonton-cli provider_config_template_replaces_model_without_losing_endpoint`
- `cargo test --locked --workspace`
- `cargo clippy --locked --workspace --all-targets -- -D warnings`
- `cargo build --release --locked -p phonton-cli`
- `target/release/phonton.exe version`
Loading