Skip to content

fix(memory): attempt plain-text fallback when session summary times out (#1869)#1887

Merged
bug-ops merged 2 commits intomainfrom
1869-session-summary-timeout-fallback
Mar 15, 2026
Merged

fix(memory): attempt plain-text fallback when session summary times out (#1869)#1887
bug-ops merged 2 commits intomainfrom
1869-session-summary-timeout-fallback

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 15, 2026

Summary

  • When call_llm_for_session_summary() times out waiting for the structured JSON output call, fall through to the plain-text chat() fallback instead of returning None and silently dropping the session summary.
  • Extract plain_text_summary_fallback() helper to share fallback logic between the Ok(Err(e)) (error) and Err(_) (timeout) arms.
  • Add shutdown_summary_timeout_secs (default: 10) to [memory] config, replacing the hardcoded 5s limit.

Root Cause

Err(_) => {
    warn!("shutdown summary: LLM call timed out after 5s");
    None  // ← no fallback attempted
}

The plain-text fallback was only reached on Ok(Err(e)), not on timeout.

Changes

  • crates/zeph-core/src/agent/mod.rs: timeout arm now calls plain_text_summary_fallback(); helper extracted from duplicated Ok(Err(e)) path
  • crates/zeph-core/src/config/types/memory.rs: shutdown_summary_timeout_secs: u64 (default: 10)
  • crates/zeph-core/src/agent/builder.rs, context/mod.rs, src/runner.rs: wired through
  • crates/zeph-core/src/agent/tests.rs: all call sites updated, 3 new assertions
  • Insta snapshots updated for both snapshot variants

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — clean
  • cargo nextest run --workspace --features full --lib --bins — 5971 passed, 12 skipped

Closes #1869

…l times out

When `call_llm_for_session_summary()` times out waiting for the structured
JSON output call, fall through to the plain-text `chat()` fallback instead
of returning `None` and silently dropping the session summary.

Extract `plain_text_summary_fallback()` helper to share the fallback path
between the error arm (`Ok(Err(e))`) and the new timeout arm (`Err(_)`).

Add `shutdown_summary_timeout_secs` (default: 10) to `MemoryConfig` to
replace the hardcoded 5s limit. Wire it through `MemoryState`,
`AgentBuilder::with_shutdown_summary_config()`, and `runner.rs`.

Closes #1869
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 15, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 15, 2026 22:23
@bug-ops bug-ops merged commit d41c8d1 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the 1869-session-summary-timeout-fallback branch March 15, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(memory): session summary on shutdown always times out with structured output (gpt-5-mini)

1 participant