Return actual error messages from 9p commands

- Capture stderr/stdout from 9p write failures
- Return helpful error messages (e.g., list of valid message types)
- Allows agents to retry with correct values
This commit is contained in:
Levi Neely 2026-02-18 22:03:50 +01:00
parent 3f5c4da1e7
commit 1139172a7e
2 changed files with 11 additions and 1 deletions

Binary file not shown.

View File

@ -285,7 +285,17 @@ func sendMessage(from, to, msgType, subject, body string) error {
mailPath := fmt.Sprintf("agent/%s/mail", from)
cmd := exec.Command("9p", "write", mailPath)
cmd.Stdin = strings.NewReader(string(data))
return cmd.Run()
// Capture both stdout and stderr to get error messages
output, err := cmd.CombinedOutput()
if err != nil {
// Return the actual error message from 9p
if len(output) > 0 {
return fmt.Errorf("%s", strings.TrimSpace(string(output)))
}
return err
}
return nil
}
func listSessions() (string, error) {