xonecas.io
60255
Zn

Zoea-Nova / commit 71e119d

chore: final cleanup for idle state message fix

xonecas2026-02-07 71e119d61aef45652defdf12cf0a1e5ffad25dae parent 47d0ba6

4 files changed

documentation/current/TODO.md+38−1
@@ -4,7 +4,6 @@
44
55 - Keep up to date.
66 - Delete completed items.
7-- When adding a new item, sort the list and group them logically, not by priority.
87 - Use blank lines to separate logical sections.
98
109 ---
@@ -12,3 +11,41 @@
1211 - Example item: example description [KEEP FOR REFERENCE ONLY]
1312
1413 ---
14+
15+- when messaging directly to mysis to restart the llm loop, the TUI shows an error:
16+
17+```
18+Error: mysis not running
19+```
20+
21+- myses become idle even when a broadcast from commander exists.
22+
23+- claim_account() marks account as is use, this is wrong, only login should do it.
24+- Server added session_id recently, ensure it's in context
25+
26+- Auto start mysis on app start: make it into an option `--start-swarm`, default off.
27+
28+- When the app is exiting, as the user presses `q` or `ESC` or `CTRL+C`, show a splash screen with branding, a text saying the app is closing connections and animated infinite loading bar, once connections are cleaned up, exit.. So the users knows what he is waiting for.
29+
30+- tool messages need JSON rendering properly
31+
32+- when nudging, encourage broadcast to restart other idle mysis
33+
34+> RELEASE CUTOFF ----~ 8< ~----
35+
36+- Refactor Help/controls pannel and error message displays in TUI.
37+ - Compact all controls in one help panel, show only [HELP h/H] on the right edge of the line.
38+ - Use the rest of the line to say:
39+ - A thematic sentence that all systems are ok when there are no errors.
40+ - If there are errored mysis, or any error non-game related (connection to game server mcp, app errors like timeouts etc. Dont confuse this with errors in game.) Display a truncated messahge, property formatted with timestamp, error source, type, truncated message.
41+
42+- when run with -debug, reset the log file for a clean run.
43+
44+- call\_-7908546343142072217:Error calling zoea_broadcast: broadcast failed: broadcast failed for 2
45+ Broadcast should never fail. Commander counts as online in broadcast.
46+
47+Follow-up (optional):
48+
49+1. Clean up skipped tests (8 tests with documented rationale)
50+2. Investigate TestStateTransition_Running_To_Idle goroutine hang
51+3. Fix TUI test environment issues (unrelated to this release)
documentation/plans/2026-02-07-fix-idle-message-blocking.md+763−0
@@ -0,0 +1,763 @@
1+# Fix Idle State Message Blocking Implementation Plan
2+
3+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4+
5+**Goal:** Allow messages to be sent to Myses in `idle` state, rejecting only `stopped` and `errored` states.
6+
7+**Architecture:** The current implementation blocks all messages when state != `MysisStateRunning`. The correct behavior is: `idle` and `running` states should accept messages, while `stopped` and `errored` states should reject them with clear error messages.
8+
9+**Tech Stack:** Go 1.22+, SQLite, Bubble Tea TUI
10+
11+---
12+
13+## Context
14+
15+**Current Incorrect Behavior:**
16+- Only `MysisStateRunning` accepts messages
17+- `idle`, `stopped`, and `errored` all reject with "mysis not running"
18+
19+**Correct Behavior Per User:**
20+- `idle` → Accept messages (auto-starts the Mysis)
21+- `running` → Accept messages (current behavior)
22+- `stopped` → Reject with "mysis stopped - press 'r' to relaunch"
23+- `errored` → Reject with "mysis errored - press 'r' to relaunch"
24+
25+**Affected Code Locations:**
26+1. `internal/core/mysis.go:352` - `SendMessageFrom` state check
27+2. `internal/core/mysis.go:660` - `SendEphemeralMessage` state check
28+3. `internal/core/mysis.go:940` - `QueueBroadcast` state check
29+4. `internal/core/commander.go:270` - `SendMessageAsync` state check (duplicate, can be removed)
30+5. `documentation/architecture/MYSIS_STATE_MACHINE.md:62` - Documentation
31+
32+---
33+
34+## Task 1: Update State Validation Helper
35+
36+**Files:**
37+- Modify: `internal/core/mysis.go` (add new helper function)
38+- Test: `internal/core/mysis_test.go`
39+
40+**Step 1: Write failing test for state validation helper**
41+
42+Add to `internal/core/mysis_test.go`:
43+
44+```go
45+func TestCanAcceptMessages(t *testing.T) {
46+ tests := []struct {
47+ state MysisState
48+ canAccept bool
49+ errMsg string
50+ }{
51+ {MysisStateIdle, true, ""},
52+ {MysisStateRunning, true, ""},
53+ {MysisStateStopped, false, "mysis stopped - press 'r' to relaunch"},
54+ {MysisStateErrored, false, "mysis errored - press 'r' to relaunch"},
55+ }
56+
57+ for _, tt := range tests {
58+ t.Run(string(tt.state), func(t *testing.T) {
59+ err := validateCanAcceptMessage(tt.state)
60+
61+ if tt.canAccept {
62+ if err != nil {
63+ t.Errorf("state %s should accept messages, got error: %v", tt.state, err)
64+ }
65+ } else {
66+ if err == nil {
67+ t.Errorf("state %s should reject messages, got nil error", tt.state)
68+ } else if err.Error() != tt.errMsg {
69+ t.Errorf("state %s: expected error %q, got %q", tt.state, tt.errMsg, err.Error())
70+ }
71+ }
72+ })
73+ }
74+}
75+```
76+
77+**Step 2: Run test to verify it fails**
78+
79+```bash
80+go test ./internal/core -run TestCanAcceptMessages -v
81+```
82+
83+Expected: FAIL with "undefined: validateCanAcceptMessage"
84+
85+**Step 3: Implement state validation helper**
86+
87+Add to `internal/core/mysis.go` after the state constants (around line 150):
88+
89+```go
90+// validateCanAcceptMessage checks if a mysis in the given state can accept messages.
91+// Returns nil if messages are allowed, error with user-facing message if not.
92+//
93+// Valid states for accepting messages:
94+// - idle: Mysis is not running but can accept messages (will process when started)
95+// - running: Mysis is actively running and processing messages
96+//
97+// Invalid states for accepting messages:
98+// - stopped: User explicitly stopped the mysis, requires relaunch
99+// - errored: Mysis encountered an error, requires relaunch
100+func validateCanAcceptMessage(state MysisState) error {
101+ switch state {
102+ case MysisStateIdle, MysisStateRunning:
103+ return nil
104+ case MysisStateStopped:
105+ return fmt.Errorf("mysis stopped - press 'r' to relaunch")
106+ case MysisStateErrored:
107+ return fmt.Errorf("mysis errored - press 'r' to relaunch")
108+ default:
109+ return fmt.Errorf("unknown mysis state: %s", state)
110+ }
111+}
112+```
113+
114+**Step 4: Run test to verify it passes**
115+
116+```bash
117+go test ./internal/core -run TestCanAcceptMessages -v
118+```
119+
120+Expected: PASS
121+
122+**Step 5: Commit**
123+
124+```bash
125+git add internal/core/mysis.go internal/core/mysis_test.go
126+git commit -m "feat: add state validation helper for message acceptance"
127+```
128+
129+---
130+
131+## Task 2: Update SendMessageFrom State Check
132+
133+**Files:**
134+- Modify: `internal/core/mysis.go:352-354`
135+- Test: `internal/core/mysis_test.go`
136+
137+**Step 1: Write failing test for SendMessageFrom with idle state**
138+
139+Add to `internal/core/mysis_test.go`:
140+
141+```go
142+func TestSendMessageFrom_IdleState(t *testing.T) {
143+ mysis, cleanup := setupTestMysis(t)
144+ defer cleanup()
145+
146+ // Mysis starts in idle state
147+ if mysis.State() != MysisStateIdle {
148+ t.Fatalf("expected idle state, got %s", mysis.State())
149+ }
150+
151+ // Should be able to send message to idle mysis
152+ err := mysis.SendMessageFrom("test message", store.MemorySourceDirect, "")
153+ if err != nil {
154+ t.Errorf("should accept message in idle state, got error: %v", err)
155+ }
156+
157+ // Verify message was stored
158+ memories, err := mysis.store.GetMemories(mysis.ID(), 10)
159+ if err != nil {
160+ t.Fatalf("failed to get memories: %v", err)
161+ }
162+ if len(memories) == 0 {
163+ t.Error("message was not stored")
164+ }
165+}
166+
167+func TestSendMessageFrom_StoppedState(t *testing.T) {
168+ mysis, cleanup := setupTestMysis(t)
169+ defer cleanup()
170+
171+ // Start then stop the mysis
172+ if err := mysis.Start(); err != nil {
173+ t.Fatalf("failed to start mysis: %v", err)
174+ }
175+ if err := mysis.Stop(); err != nil {
176+ t.Fatalf("failed to stop mysis: %v", err)
177+ }
178+
179+ if mysis.State() != MysisStateStopped {
180+ t.Fatalf("expected stopped state, got %s", mysis.State())
181+ }
182+
183+ // Should NOT be able to send message to stopped mysis
184+ err := mysis.SendMessageFrom("test message", store.MemorySourceDirect, "")
185+ if err == nil {
186+ t.Error("should reject message in stopped state")
187+ }
188+ if !strings.Contains(err.Error(), "stopped") || !strings.Contains(err.Error(), "relaunch") {
189+ t.Errorf("error should mention stopped and relaunch, got: %v", err)
190+ }
191+}
192+
193+func TestSendMessageFrom_ErroredState(t *testing.T) {
194+ mysis, cleanup := setupTestMysisWithErrorProvider(t)
195+ defer cleanup()
196+
197+ // Start mysis and trigger error
198+ if err := mysis.Start(); err != nil {
199+ t.Fatalf("failed to start mysis: %v", err)
200+ }
201+
202+ // Send message to trigger error
203+ _ = mysis.SendMessageFrom("trigger error", store.MemorySourceDirect, "")
204+
205+ // Wait for error state
206+ time.Sleep(100 * time.Millisecond)
207+
208+ if mysis.State() != MysisStateErrored {
209+ t.Fatalf("expected errored state, got %s", mysis.State())
210+ }
211+
212+ // Should NOT be able to send message to errored mysis
213+ err := mysis.SendMessageFrom("test message", store.MemorySourceDirect, "")
214+ if err == nil {
215+ t.Error("should reject message in errored state")
216+ }
217+ if !strings.Contains(err.Error(), "errored") || !strings.Contains(err.Error(), "relaunch") {
218+ t.Errorf("error should mention errored and relaunch, got: %v", err)
219+ }
220+}
221+```
222+
223+**Step 2: Run tests to verify they fail**
224+
225+```bash
226+go test ./internal/core -run "TestSendMessageFrom_(Idle|Stopped|Errored)" -v
227+```
228+
229+Expected:
230+- `TestSendMessageFrom_IdleState`: FAIL with "should accept message in idle state, got error: mysis not running"
231+- `TestSendMessageFrom_StoppedState`: PASS (already rejects correctly, but wrong error message)
232+- `TestSendMessageFrom_ErroredState`: PASS (already rejects correctly, but wrong error message)
233+
234+**Step 3: Update SendMessageFrom state check**
235+
236+In `internal/core/mysis.go`, replace lines 352-354:
237+
238+```go
239+// OLD (remove):
240+if state != MysisStateRunning {
241+ return fmt.Errorf("mysis not running")
242+}
243+
244+// NEW (replace with):
245+if err := validateCanAcceptMessage(state); err != nil {
246+ return err
247+}
248+```
249+
250+**Step 4: Run tests to verify they pass**
251+
252+```bash
253+go test ./internal/core -run "TestSendMessageFrom_(Idle|Stopped|Errored)" -v
254+```
255+
256+Expected: All PASS
257+
258+**Step 5: Run full mysis test suite to check for regressions**
259+
260+```bash
261+go test ./internal/core -run TestMysis -v
262+```
263+
264+Expected: All PASS (some tests might need adjustment)
265+
266+**Step 6: Commit**
267+
268+```bash
269+git add internal/core/mysis.go internal/core/mysis_test.go
270+git commit -m "fix: allow SendMessageFrom in idle state, improve error messages"
271+```
272+
273+---
274+
275+## Task 3: Update SendEphemeralMessage State Check
276+
277+**Files:**
278+- Modify: `internal/core/mysis.go:659-661`
279+
280+**Step 1: Write failing test**
281+
282+Add to `internal/core/mysis_test.go`:
283+
284+```go
285+func TestSendEphemeralMessage_IdleState(t *testing.T) {
286+ mysis, cleanup := setupTestMysis(t)
287+ defer cleanup()
288+
289+ // Mysis starts in idle state
290+ if mysis.State() != MysisStateIdle {
291+ t.Fatalf("expected idle state, got %s", mysis.State())
292+ }
293+
294+ // Should be able to send ephemeral message to idle mysis
295+ err := mysis.SendEphemeralMessage("ephemeral test", store.MemorySourceDirect)
296+ if err != nil {
297+ t.Errorf("should accept ephemeral message in idle state, got error: %v", err)
298+ }
299+}
300+
301+func TestSendEphemeralMessage_StoppedState(t *testing.T) {
302+ mysis, cleanup := setupTestMysis(t)
303+ defer cleanup()
304+
305+ // Start then stop
306+ if err := mysis.Start(); err != nil {
307+ t.Fatalf("failed to start: %v", err)
308+ }
309+ if err := mysis.Stop(); err != nil {
310+ t.Fatalf("failed to stop: %v", err)
311+ }
312+
313+ // Should reject ephemeral message in stopped state
314+ err := mysis.SendEphemeralMessage("ephemeral test", store.MemorySourceDirect)
315+ if err == nil {
316+ t.Error("should reject ephemeral message in stopped state")
317+ }
318+ if !strings.Contains(err.Error(), "stopped") {
319+ t.Errorf("error should mention stopped, got: %v", err)
320+ }
321+}
322+```
323+
324+**Step 2: Run tests to verify they fail**
325+
326+```bash
327+go test ./internal/core -run "TestSendEphemeralMessage_(Idle|Stopped)" -v
328+```
329+
330+Expected: FAIL on idle test
331+
332+**Step 3: Update SendEphemeralMessage state check**
333+
334+In `internal/core/mysis.go`, replace lines 659-661:
335+
336+```go
337+// OLD (remove):
338+if state != MysisStateRunning {
339+ return fmt.Errorf("mysis not running")
340+}
341+
342+// NEW (replace with):
343+if err := validateCanAcceptMessage(state); err != nil {
344+ return err
345+}
346+```
347+
348+**Step 4: Run tests to verify they pass**
349+
350+```bash
351+go test ./internal/core -run "TestSendEphemeralMessage_(Idle|Stopped)" -v
352+```
353+
354+Expected: All PASS
355+
356+**Step 5: Commit**
357+
358+```bash
359+git add internal/core/mysis.go internal/core/mysis_test.go
360+git commit -m "fix: allow SendEphemeralMessage in idle state"
361+```
362+
363+---
364+
365+## Task 4: Update QueueBroadcast State Check
366+
367+**Files:**
368+- Modify: `internal/core/mysis.go:939-941`
369+
370+**Step 1: Write failing test**
371+
372+Add to `internal/core/mysis_test.go`:
373+
374+```go
375+func TestQueueBroadcast_IdleState(t *testing.T) {
376+ mysis, cleanup := setupTestMysis(t)
377+ defer cleanup()
378+
379+ // Mysis starts in idle state
380+ if mysis.State() != MysisStateIdle {
381+ t.Fatalf("expected idle state, got %s", mysis.State())
382+ }
383+
384+ // Should be able to queue broadcast to idle mysis
385+ err := mysis.QueueBroadcast("broadcast test", "sender-id")
386+ if err != nil {
387+ t.Errorf("should accept broadcast in idle state, got error: %v", err)
388+ }
389+
390+ // Verify message was stored
391+ memories, err := mysis.store.GetMemories(mysis.ID(), 10)
392+ if err != nil {
393+ t.Fatalf("failed to get memories: %v", err)
394+ }
395+ if len(memories) == 0 {
396+ t.Error("broadcast was not stored")
397+ }
398+}
399+
400+func TestQueueBroadcast_StoppedState(t *testing.T) {
401+ mysis, cleanup := setupTestMysis(t)
402+ defer cleanup()
403+
404+ // Start then stop
405+ if err := mysis.Start(); err != nil {
406+ t.Fatalf("failed to start: %v", err)
407+ }
408+ if err := mysis.Stop(); err != nil {
409+ t.Fatalf("failed to stop: %v", err)
410+ }
411+
412+ // Should reject broadcast in stopped state
413+ err := mysis.QueueBroadcast("broadcast test", "sender-id")
414+ if err == nil {
415+ t.Error("should reject broadcast in stopped state")
416+ }
417+ if !strings.Contains(err.Error(), "stopped") {
418+ t.Errorf("error should mention stopped, got: %v", err)
419+ }
420+}
421+```
422+
423+**Step 2: Run tests to verify they fail**
424+
425+```bash
426+go test ./internal/core -run "TestQueueBroadcast_(Idle|Stopped)" -v
427+```
428+
429+Expected: FAIL on idle test
430+
431+**Step 3: Update QueueBroadcast state check**
432+
433+In `internal/core/mysis.go`, replace lines 939-941:
434+
435+```go
436+// OLD (remove):
437+if state != MysisStateRunning {
438+ return fmt.Errorf("mysis not running")
439+}
440+
441+// NEW (replace with):
442+if err := validateCanAcceptMessage(state); err != nil {
443+ return err
444+}
445+```
446+
447+**Step 4: Run tests to verify they pass**
448+
449+```bash
450+go test ./internal/core -run "TestQueueBroadcast_(Idle|Stopped)" -v
451+```
452+
453+Expected: All PASS
454+
455+**Step 5: Commit**
456+
457+```bash
458+git add internal/core/mysis.go internal/core/mysis_test.go
459+git commit -m "fix: allow QueueBroadcast in idle state"
460+```
461+
462+---
463+
464+## Task 5: Remove Duplicate State Check in Commander
465+
466+**Files:**
467+- Modify: `internal/core/commander.go:264-278`
468+
469+**Step 1: Analyze the duplicate check**
470+
471+The `SendMessageAsync` method in Commander checks state before calling `mysis.SendMessage`, which will check state again. This is redundant and can cause inconsistent error messages.
472+
473+**Step 2: Remove duplicate check**
474+
475+In `internal/core/commander.go`, replace lines 264-278:
476+
477+```go
478+// OLD (remove entire function):
479+func (c *Commander) SendMessageAsync(id, content string) error {
480+ mysis, err := c.GetMysis(id)
481+ if err != nil {
482+ return err
483+ }
484+ if mysis.State() != MysisStateRunning {
485+ return fmt.Errorf("mysis not running")
486+ }
487+ go func() {
488+ if err := mysis.SendMessage(content, store.MemorySourceDirect); err != nil {
489+ // Error is published to bus by mysis.SendMessage
490+ }
491+ }()
492+ return nil
493+}
494+
495+// NEW (replace with):
496+func (c *Commander) SendMessageAsync(id, content string) error {
497+ mysis, err := c.GetMysis(id)
498+ if err != nil {
499+ return err
500+ }
501+ // State validation is done inside mysis.SendMessage
502+ go func() {
503+ if err := mysis.SendMessage(content, store.MemorySourceDirect); err != nil {
504+ // Error is published to bus by mysis.SendMessage
505+ }
506+ }()
507+ return nil
508+}
509+```
510+
511+**Step 3: Check if SendMessageAsync is tested**
512+
513+```bash
514+grep -n "SendMessageAsync" /home/xonecas/src/zoea-nova/internal/core/*test.go
515+```
516+
517+**Step 4: Run commander tests**
518+
519+```bash
520+go test ./internal/core -run TestCommander -v
521+```
522+
523+Expected: All PASS
524+
525+**Step 5: Commit**
526+
527+```bash
528+git add internal/core/commander.go
529+git commit -m "refactor: remove duplicate state check in SendMessageAsync"
530+```
531+
532+---
533+
534+## Task 6: Update Test Expectations
535+
536+**Files:**
537+- Modify: `internal/core/long_running_stop_test.go:339-342`
538+
539+**Step 1: Update test that expects rejection after stop**
540+
541+In `internal/core/long_running_stop_test.go`, update the test around line 339:
542+
543+```go
544+// OLD (line 339-342):
545+err := mysis.SendMessage("after-stop", store.MemorySourceDirect)
546+if err == nil {
547+ t.Error("expected error sending message to stopped mysis")
548+}
549+
550+// NEW (replace with):
551+err := mysis.SendMessage("after-stop", store.MemorySourceDirect)
552+if err == nil {
553+ t.Error("expected error sending message to stopped mysis")
554+}
555+if !strings.Contains(err.Error(), "stopped") || !strings.Contains(err.Error(), "relaunch") {
556+ t.Errorf("expected error about stopped state requiring relaunch, got: %v", err)
557+}
558+```
559+
560+**Step 2: Run the test**
561+
562+```bash
563+go test ./internal/core -run TestQueuedMessagesFailAfterStop -v
564+```
565+
566+Expected: PASS
567+
568+**Step 3: Commit**
569+
570+```bash
571+git add internal/core/long_running_stop_test.go
572+git commit -m "test: update stopped state error message expectation"
573+```
574+
575+---
576+
577+## Task 7: Update Documentation
578+
579+**Files:**
580+- Modify: `documentation/architecture/MYSIS_STATE_MACHINE.md`
581+
582+**Step 1: Update state machine documentation**
583+
584+In `documentation/architecture/MYSIS_STATE_MACHINE.md`, replace line 62 and add clarification:
585+
586+```markdown
587+## Message Acceptance
588+
589+Messages can be sent to Myses in `idle` and `running` states:
590+
591+- **`idle`**: Accepts messages. Messages are stored and will be processed when the Mysis is started.
592+- **`running`**: Accepts messages. Messages are processed immediately.
593+- **`stopped`**: Rejects messages with error "mysis stopped - press 'r' to relaunch"
594+- **`errored`**: Rejects messages with error "mysis errored - press 'r' to relaunch"
595+
596+User-initiated stop (`stopped` state) and error conditions (`errored` state) require explicit relaunch before messages can be sent.
597+```
598+
599+**Step 2: Update state descriptions**
600+
601+Around lines 6-10, update state descriptions:
602+
603+```markdown
604+## States
605+
606+- `idle`: Not running, but accepts messages. Messages are stored and processed when started. Set on creation and when a mysis fails 3 nudges; requires a commander message/broadcast or explicit start to resume processing.
607+- `running`: Active and eligible for nudges; waiting between loop iterations. Accepts messages.
608+- `stopped`: Explicitly stopped by user action. Rejects messages until relaunched.
609+- `errored`: Provider or MCP failures after retries; recorded as `lastError`. Rejects messages until relaunched.
610+```
611+
612+**Step 3: Review entire document for consistency**
613+
614+Read through the entire document to ensure no contradictions with the new behavior.
615+
616+**Step 4: Commit**
617+
618+```bash
619+git add documentation/architecture/MYSIS_STATE_MACHINE.md
620+git commit -m "docs: update state machine message acceptance rules"
621+```
622+
623+---
624+
625+## Task 8: Update Known Issues
626+
627+**Files:**
628+- Modify: `documentation/current/KNOWN_ISSUES.md`
629+
630+**Step 1: Remove the issue if it's listed**
631+
632+Check if this bug is documented in KNOWN_ISSUES.md. If so, remove it.
633+
634+```bash
635+grep -n "idle.*message\|message.*idle\|not running" documentation/current/KNOWN_ISSUES.md
636+```
637+
638+**Step 2: Commit if changes made**
639+
640+```bash
641+git add documentation/current/KNOWN_ISSUES.md
642+git commit -m "docs: remove fixed idle state message blocking from known issues"
643+```
644+
645+---
646+
647+## Task 9: Integration Testing
648+
649+**Files:**
650+- Test entire flow manually and with existing tests
651+
652+**Step 1: Run all core tests**
653+
654+```bash
655+go test ./internal/core -v -count=1
656+```
657+
658+Expected: All PASS
659+
660+**Step 2: Run all TUI tests**
661+
662+```bash
663+go test ./internal/tui -v -count=1
664+```
665+
666+Expected: All PASS
667+
668+**Step 3: Build and manual test**
669+
670+```bash
671+make build
672+```
673+
674+**Step 4: Manual TUI test**
675+
676+1. Start application: `./bin/zoea --offline`
677+2. Create a new Mysis (it starts in `idle` state)
678+3. Press `m` to send a message to the idle Mysis
679+4. Verify: Message should be accepted without error
680+5. Press `r` to start the Mysis
681+6. Press `s` to stop the Mysis
682+7. Press `m` to send a message to the stopped Mysis
683+8. Verify: Should show error "mysis stopped - press 'r' to relaunch"
684+
685+**Step 5: Document test results**
686+
687+If any issues found, fix them before proceeding.
688+
689+---
690+
691+## Task 10: Final Commit and Verification
692+
693+**Step 1: Run make test**
694+
695+```bash
696+make test
697+```
698+
699+Expected: All tests PASS
700+
701+**Step 2: Run make fmt**
702+
703+```bash
704+make fmt
705+```
706+
707+**Step 3: Check git status**
708+
709+```bash
710+git status
711+```
712+
713+Verify all changes are committed.
714+
715+**Step 4: Create summary commit if needed**
716+
717+If there are any uncommitted doc changes or minor fixes:
718+
719+```bash
720+git add -A
721+git commit -m "chore: final cleanup for idle state message fix"
722+```
723+
724+**Step 5: Review all commits**
725+
726+```bash
727+git log --oneline HEAD~10..HEAD
728+```
729+
730+Verify commits follow conventional commit style and are logically organized.
731+
732+---
733+
734+## Verification Checklist
735+
736+- [ ] `validateCanAcceptMessage` helper function added and tested
737+- [ ] `SendMessageFrom` accepts messages in `idle` state
738+- [ ] `SendEphemeralMessage` accepts messages in `idle` state
739+- [ ] `QueueBroadcast` accepts messages in `idle` state
740+- [ ] `stopped` and `errored` states show clear, actionable error messages
741+- [ ] Duplicate state check removed from `Commander.SendMessageAsync`
742+- [ ] All existing tests updated for new error messages
743+- [ ] New tests added for idle state message acceptance
744+- [ ] Documentation updated to reflect correct behavior
745+- [ ] Manual TUI testing confirms expected behavior
746+- [ ] All tests pass: `make test`
747+- [ ] Code formatted: `make fmt`
748+
749+---
750+
751+## Notes
752+
753+**State Transition Behavior:**
754+
755+The key insight is that `idle` state means "not actively running but ready to accept work". Messages sent to idle Myses should be stored and ready for processing. This is different from `stopped` (user intentionally paused) and `errored` (system failure) which require explicit relaunch.
756+
757+**Error Message Design:**
758+
759+The new error messages guide users to the correct action (`press 'r' to relaunch`) rather than leaving them confused about what "not running" means.
760+
761+**Test Coverage:**
762+
763+Tests cover all four states (idle, running, stopped, errored) for all three message methods (SendMessageFrom, SendEphemeralMessage, QueueBroadcast) to ensure consistent behavior.
internal/core/activity_state_test.go+3−3
@@ -7,7 +7,7 @@ import (
77
88 func TestMysis_ActivityStateAccessor(t *testing.T) {
99 m := &Mysis{activityState: ActivityStateTraveling}
10-
10+
1111 if m.ActivityState() != ActivityStateTraveling {
1212 t.Errorf("expected traveling, got %v", m.ActivityState())
1313 }
@@ -16,7 +16,7 @@ func TestMysis_ActivityStateAccessor(t *testing.T) {
1616 func TestMysis_SetActivityLLM(t *testing.T) {
1717 m := &Mysis{activityState: ActivityStateIdle}
1818 m.setActivity(ActivityStateLLMCall, time.Time{})
19-
19+
2020 if m.activityState != ActivityStateLLMCall {
2121 t.Errorf("expected llm_call, got %v", m.activityState)
2222 }
@@ -25,7 +25,7 @@ func TestMysis_SetActivityLLM(t *testing.T) {
2525 func TestMysis_SetActivityMCP(t *testing.T) {
2626 m := &Mysis{activityState: ActivityStateIdle}
2727 m.setActivity(ActivityStateMCPCall, time.Time{})
28-
28+
2929 if m.activityState != ActivityStateMCPCall {
3030 t.Errorf("expected mcp_call, got %v", m.activityState)
3131 }
internal/tui/broadcast_filter_test.go+6−6
@@ -1,9 +1,9 @@
11 package tui
22
33 import (
4+ "github.com/xonecas/zoea-nova/internal/store"
45 "testing"
56 "time"
6- "github.com/xonecas/zoea-nova/internal/store"
77 )
88
99 func TestBroadcastFiltering(t *testing.T) {
@@ -16,7 +16,7 @@ func TestBroadcastFiltering(t *testing.T) {
1616 {Role: store.MemoryRoleTool, Source: store.MemorySourceTool, Content: "Tool result", CreatedAt: time.Now()},
1717 {Role: store.MemoryRoleUser, Source: store.MemorySourceDirect, Content: "Direct message 2", CreatedAt: time.Now()},
1818 }
19-
19+
2020 // Apply the filtering (same logic as loadMysisLogs)
2121 var filteredLogs []LogEntry
2222 for _, mem := range memories {
@@ -26,20 +26,20 @@ func TestBroadcastFiltering(t *testing.T) {
2626 }
2727 filteredLogs = append(filteredLogs, LogEntryFromMemory(mem, "test-mysis", ""))
2828 }
29-
29+
3030 // Verify filtering
3131 expectedCount := 4 // 2 direct, 1 LLM, 1 tool (excluding 2 broadcasts)
3232 if len(filteredLogs) != expectedCount {
3333 t.Errorf("Expected %d filtered logs, got %d", expectedCount, len(filteredLogs))
3434 }
35-
35+
3636 // Verify no broadcasts in filtered logs
3737 for i, log := range filteredLogs {
3838 if log.Source == "broadcast" || log.Source == "broadcast_self" {
3939 t.Errorf("Log %d should not be a broadcast: source=%s, content=%s", i, log.Source, log.Content)
4040 }
4141 }
42-
42+
4343 // Verify expected messages are present
4444 expectedMessages := []string{
4545 "Direct message 1",
@@ -47,7 +47,7 @@ func TestBroadcastFiltering(t *testing.T) {
4747 "Tool result",
4848 "Direct message 2",
4949 }
50-
50+
5151 for i, expected := range expectedMessages {
5252 if i >= len(filteredLogs) {
5353 t.Errorf("Missing expected message: %s", expected)