Skip to content

fix(context): fall back to in-process when daemon returns empty context#95

Open
bunny-bot-openclaw wants to merge 1 commit into
mainfrom
fix/context-cli-daemon-empty-fallback
Open

fix(context): fall back to in-process when daemon returns empty context#95
bunny-bot-openclaw wants to merge 1 commit into
mainfrom
fix/context-cli-daemon-empty-fallback

Conversation

@bunny-bot-openclaw

Copy link
Copy Markdown
Collaborator

Summary

  • The warm daemon (cashew serve) can return {"ok": true, "result": ""} when generate_session_context() silently fails inside the daemon process (e.g. stale code, different cwd, or a swallowed exception inside the function's try/except).
  • cmd_context was accepting an empty string as a valid daemon result and setting context = "". Since "" is not None, the in-process fallback on line 98 was never reached.
  • Result: every session start printed "No context generated (empty result)" — confirmed as the root cause of 0% brain usage for 3 weeks.

Fix

Only accept the daemon result when it is a truthy (non-empty) string. An empty result now falls through to in-process generate_session_context(), the same code path used when the daemon is unreachable.

Test plan

  • Verified cashew_context.py context --hints "bunny identity" now returns full context with the warm daemon running
  • Verified CASHEW_NO_DAEMON=1 path works unchanged
  • 88/89 tests pass; the one failing test (test_embed_op_roundtrips) is a pre-existing unrelated failure in embedding model API

🤖 Generated with Claude Code

The warm daemon can return ok=True with an empty result string when
generate_session_context() silently fails inside the daemon process
(e.g. after the daemon was started with stale code or a different cwd).

Previously cmd_context accepted an empty string as the daemon result and
skipped the in-process fallback because context was not None. This caused
every session boot to print "No context generated" even though the graph
was healthy, leaving Bunny with zero brain context for 3+ weeks.

Fix: only accept the daemon result when it is a non-empty string. An
empty result falls through to in-process generate_session_context(), the
same path used when the daemon is unreachable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants