fix: add Message field to session.Entry and check marshal error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mathias Bergqvist
2026-04-17 20:43:01 +02:00
parent 9cfce8f700
commit a2889645fc
2 changed files with 6 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ type Entry struct {
FilePath string `json:"file_path,omitempty"` FilePath string `json:"file_path,omitempty"`
ModelUsed string `json:"model_used,omitempty"` ModelUsed string `json:"model_used,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"` DurationMs int64 `json:"duration_ms,omitempty"`
Message string `json:"message,omitempty"`
} }
// Attempt represents one subprocess invocation within a skill call. // Attempt represents one subprocess invocation within a skill call.

View File

@@ -45,10 +45,14 @@ func (s *Skill) Handle(ctx context.Context, tool string, args json.RawMessage) (
FilePath: a.FilePath, FilePath: a.FilePath,
ModelUsed: a.ModelUsed, ModelUsed: a.ModelUsed,
DurationMs: a.DurationMs, DurationMs: a.DurationMs,
Message: a.Message,
} }
if err := session.Append(s.cfg.SessionsDir, a.SessionID, entry); err != nil { if err := session.Append(s.cfg.SessionsDir, a.SessionID, entry); err != nil {
return nil, fmt.Errorf("append session log: %w", err) return nil, fmt.Errorf("append session log: %w", err)
} }
b, _ := json.Marshal(map[string]string{"status": "ok", "session_id": a.SessionID}) b, err := json.Marshal(map[string]string{"status": "ok", "session_id": a.SessionID})
if err != nil {
return nil, fmt.Errorf("marshal response: %w", err)
}
return b, nil return b, nil
} }