Skip to content

Commit ebcdc17

Browse files
committed
default resilience
1 parent 45e06b9 commit ebcdc17

File tree

10 files changed

+240
-29
lines changed

10 files changed

+240
-29
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Bug Report
2+
description: Report a bug or unexpected behavior
3+
labels: ["bug"]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: Description
9+
description: What happened?
10+
placeholder: Describe the bug clearly and concisely.
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: expected
16+
attributes:
17+
label: Expected Behavior
18+
description: What did you expect to happen?
19+
validations:
20+
required: true
21+
22+
- type: textarea
23+
id: steps
24+
attributes:
25+
label: Steps to Reproduce
26+
description: How can we reproduce this?
27+
placeholder: |
28+
1. Run `openfang start`
29+
2. Open dashboard at http://localhost:4200
30+
3. Click ...
31+
validations:
32+
required: true
33+
34+
- type: input
35+
id: version
36+
attributes:
37+
label: OpenFang Version
38+
description: Output of `openfang -V`
39+
placeholder: "0.3.23"
40+
validations:
41+
required: true
42+
43+
- type: dropdown
44+
id: os
45+
attributes:
46+
label: Operating System
47+
options:
48+
- Linux (x86_64)
49+
- Linux (aarch64/ARM64)
50+
- macOS (Apple Silicon)
51+
- macOS (Intel)
52+
- Windows
53+
- Android (Termux)
54+
- Other
55+
validations:
56+
required: true
57+
58+
- type: textarea
59+
id: logs
60+
attributes:
61+
label: Logs / Screenshots
62+
description: Paste relevant logs or attach screenshots.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Feature Request
2+
description: Suggest a new feature or improvement
3+
labels: ["enhancement"]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: Description
9+
description: What feature would you like?
10+
placeholder: Describe the feature and why it would be useful.
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: alternatives
16+
attributes:
17+
label: Alternatives Considered
18+
description: Have you tried any workarounds?
19+
20+
- type: textarea
21+
id: context
22+
attributes:
23+
label: Additional Context
24+
description: Any other context, screenshots, or references.

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 5
8+
labels:
9+
- "dependencies"
10+
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
open-pull-requests-limit: 3
16+
labels:
17+
- "ci"

.github/pull_request_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Summary
2+
3+
<!-- What does this PR do? Link related issues with "Fixes #123". -->
4+
5+
## Changes
6+
7+
<!-- Brief list of what changed. -->
8+
9+
## Testing
10+
11+
- [ ] `cargo clippy --workspace --all-targets -- -D warnings` passes
12+
- [ ] `cargo test --workspace` passes
13+
- [ ] Live integration tested (if applicable)
14+
15+
## Security
16+
17+
- [ ] No new unsafe code
18+
- [ ] No secrets or API keys in diff
19+
- [ ] User input validated at boundaries

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ members = [
1818
]
1919

2020
[workspace.package]
21-
version = "0.3.23"
21+
version = "0.3.24"
2222
edition = "2021"
2323
license = "Apache-2.0 OR MIT"
2424
repository = "https://github.com/RightNow-AI/openfang"

crates/openfang-cli/src/main.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,20 +2075,23 @@ fn cmd_doctor(json: bool, repair: bool) {
20752075
}
20762076
let answer = prompt_input(" Create default config? [Y/n] ");
20772077
if answer.is_empty() || answer.starts_with('y') || answer.starts_with('Y') {
2078-
let default_config = r#"# OpenFang Agent OS configuration
2078+
let (provider, api_key_env, model) = detect_best_provider();
2079+
let default_config = format!(
2080+
r#"# OpenFang Agent OS configuration
20792081
# See https://github.com/RightNow-AI/openfang for documentation
20802082
20812083
# For Docker, change to "0.0.0.0:4200" or set OPENFANG_LISTEN env var.
20822084
api_listen = "127.0.0.1:4200"
20832085
20842086
[default_model]
2085-
provider = "groq"
2086-
model = "llama-3.3-70b-versatile"
2087-
api_key_env = "GROQ_API_KEY"
2087+
provider = "{provider}"
2088+
model = "{model}"
2089+
api_key_env = "{api_key_env}"
20882090
20892091
[memory]
20902092
decay_rate = 0.05
2091-
"#;
2093+
"#
2094+
);
20922095
let _ = std::fs::create_dir_all(&openfang_dir);
20932096
if std::fs::write(&config_path, default_config).is_ok() {
20942097
restrict_file_permissions(&config_path);

crates/openfang-kernel/src/kernel.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,24 +1027,31 @@ impl OpenFangKernel {
10271027
&mut restored_entry.manifest.resources,
10281028
);
10291029

1030-
// Apply default_model to restored agents (same logic as spawn)
1030+
// Apply default_model to restored agents.
1031+
//
1032+
// Two cases:
1033+
// 1. Agent has empty/default provider → always apply default_model
1034+
// 2. Agent named "assistant" (auto-spawned) → update to match
1035+
// default_model so config.toml changes take effect on restart
10311036
{
1037+
let dm = &kernel.config.default_model;
10321038
let is_default_provider = restored_entry.manifest.model.provider.is_empty()
10331039
|| restored_entry.manifest.model.provider == "default";
10341040
let is_default_model = restored_entry.manifest.model.model.is_empty()
10351041
|| restored_entry.manifest.model.model == "default";
1036-
if is_default_provider && is_default_model {
1037-
let dm = &kernel.config.default_model;
1042+
let is_auto_spawned = restored_entry.name == "assistant"
1043+
&& restored_entry.manifest.description == "General-purpose assistant";
1044+
if is_default_provider && is_default_model || is_auto_spawned {
10381045
if !dm.provider.is_empty() {
10391046
restored_entry.manifest.model.provider = dm.provider.clone();
10401047
}
10411048
if !dm.model.is_empty() {
10421049
restored_entry.manifest.model.model = dm.model.clone();
10431050
}
1044-
if !dm.api_key_env.is_empty() && restored_entry.manifest.model.api_key_env.is_none() {
1051+
if !dm.api_key_env.is_empty() {
10451052
restored_entry.manifest.model.api_key_env = Some(dm.api_key_env.clone());
10461053
}
1047-
if dm.base_url.is_some() && restored_entry.manifest.model.base_url.is_none() {
1054+
if dm.base_url.is_some() {
10481055
restored_entry.manifest.model.base_url.clone_from(&dm.base_url);
10491056
}
10501057
}

crates/openfang-kernel/src/wizard.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ impl SetupWizard {
5454
/// model configuration, capabilities, and schedule.
5555
pub fn build_plan(intent: AgentIntent) -> SetupPlan {
5656
// Map model tier to provider/model
57+
// Use "default" so the kernel applies config.toml's [default_model].
58+
// Only "complex" tier gets an explicit Anthropic override.
5759
let (provider, model) = match intent.model_tier.as_str() {
58-
"simple" => ("groq", "llama-3.3-70b-versatile"),
5960
"complex" => ("anthropic", "claude-sonnet-4-20250514"),
60-
_ => ("groq", "llama-3.3-70b-versatile"), // medium default
61+
_ => ("default", "default"),
6162
};
6263

6364
// Build capabilities from intent
@@ -285,7 +286,7 @@ mod tests {
285286
let plan = SetupWizard::build_plan(intent);
286287

287288
assert_eq!(plan.manifest.name, "research-bot");
288-
assert_eq!(plan.manifest.model.provider, "groq");
289+
assert_eq!(plan.manifest.model.provider, "default");
289290
assert!(plan
290291
.manifest
291292
.capabilities

0 commit comments

Comments
 (0)