Skip to content

Commit 2565a3c

Browse files
committed
feat: remove additional message upon load state fail
1 parent 058b18f commit 2565a3c

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

lib/screentracker/pty_conversation.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,6 @@ func (c *PTYConversation) Start(ctx context.Context) {
195195

196196
if c.initialPromptReady && !c.loadStateSuccessful && c.cfg.StatePersistenceConfig.LoadState {
197197
if err := c.loadStateLocked(); err != nil {
198-
// Add error message to conversation so user is aware
199-
errorMsg := fmt.Sprintf("AgentAPI state restoration failed, the conversation history may be missing: %v", err)
200-
c.messages = append(c.messages, ConversationMessage{
201-
Id: len(c.messages),
202-
Message: errorMsg,
203-
Role: ConversationRoleAgent,
204-
Time: c.cfg.Clock.Now(),
205-
})
206198
c.cfg.Logger.Error("Failed to load state", "error", err)
207199
}
208200
c.loadStateSuccessful = true
@@ -627,7 +619,6 @@ func (c *PTYConversation) loadStateLocked() error {
627619
// Open state file
628620
f, err := os.Open(stateFile)
629621
if err != nil {
630-
c.cfg.Logger.Warn("Failed to open state file", "path", stateFile, "err", err)
631622
return xerrors.Errorf("failed to open state file: %w", err)
632623
}
633624
defer func() {
@@ -643,7 +634,6 @@ func (c *PTYConversation) loadStateLocked() error {
643634
c.cfg.Logger.Info("No previous state to load (file is empty)", "path", stateFile)
644635
return nil
645636
}
646-
c.cfg.Logger.Warn("Failed to load state file (corrupted or invalid JSON)", "path", stateFile, "err", err)
647637
return xerrors.Errorf("failed to unmarshal state (corrupted or invalid JSON): %w", err)
648638
}
649639

0 commit comments

Comments
 (0)