refactor: surface silent fallbacks with eprintln! logging

Add eprintln! logging before fallback values in 7 files where errors
were previously swallowed without visibility:

- [stream] malformed JSON chunk, missing usage tokens, missing tool call index
- [mcp] missing result fields, client builder failure, response body read error
- [subagent] missing API key in settings, all resolution paths exhausted
- [state] memory_dir no-parent, session_id missing, lock poisoned, store_base_dir
- [input] missing default_model for provider
- [session] corrupt agents.json parse failure
- [pkce] clock-before-epoch on random byte generation

All fallback values are preserved — this adds observability without
changing behavior for callers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
asepharyana
2026-07-12 10:50:34 +07:00
co-authored by Claude Opus 4.8
parent bb621fdff2
commit e29dfadaa7
7 changed files with 97 additions and 25 deletions
+4 -1
View File
@@ -244,7 +244,10 @@ fn handle_overlay_enter(state: &mut AppStateRest) -> Vec<Action> {
let providers: Vec<String> = state.app_config.providers.keys().cloned().collect();
if let Some(provider) = providers.get(state.misc.selected_index) {
if let Some(cfg) = state.app_config.providers.get(provider) {
let model = cfg.default_model.clone().unwrap_or_else(|| "claude-opus-4-8".to_string());
let model = cfg.default_model.clone().unwrap_or_else(|| {
eprintln!("[input] provider '{}' has no default_model, using 'claude-opus-4-8'", provider);
"claude-opus-4-8".to_string()
});
state.settings.provider = provider.clone();
state.settings.model = model.clone();
if let Some(ref key) = cfg.default_api_key {