Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
Fix for 'exit status 128' errors in a couple of edge case scenarios.
Dane Schneiderabbc8fcdae7d
diff --git a/app/server/model/plan/tell_stream.go b/app/server/model/plan/tell_stream.goindex d61cd9c7..cf258948 100644--- a/app/server/model/plan/tell_stream.go+++ b/app/server/model/plan/tell_stream.go@@ -1,6 +1,7 @@package planimport (+ "context""fmt""log""net/http"@@ -593,47 +594,82 @@ func (state *activeTellStreamState) onError(streamErr error, storeDesc bool, conreturn}- active.StreamDoneCh <- &shared.ApiError{- Type: shared.ApiErrorTypeOther,- Status: http.StatusInternalServerError,- Msg: "Stream error: " + streamErr.Error(),- }+ storeDescAndReply := func() {+ ctx, cancelFn := context.WithCancel(context.Background())++ repoLockId, err := db.LockRepo(+ db.LockRepoParams{+ UserId: state.currentUserId,+ OrgId: state.currentOrgId,+ PlanId: planId,+ Branch: branch,+ Scope: db.LockScopeWrite,+ Ctx: ctx,+ CancelFn: cancelFn,+ },+ )- storedMessage := false- storedDesc := false-- if convoMessageId == "" {- assistantMsg, msg, err := state.storeAssistantReply()- if err == nil {- convoMessageId = assistantMsg.Id- commitMsg = msg- storedMessage = true+ if err != nil {+ log.Printf("Error locking repo for plan %s: %v\n", planId, err)} else {- log.Printf("Error storing assistant message after stream error: %v\n", err)++ defer func() {+ err := db.UnlockRepo(repoLockId)+ if err != nil {+ log.Printf("Error unlocking repo for plan %s: %v\n", planId, err)+ }+ }()++ err := db.GitClearUncommittedChanges(state.currentOrgId, planId)+ if err != nil {+ log.Printf("Error clearing uncommitted changes for plan %s: %v\n", planId, err)+ }}- }- if storeDesc && convoMessageId != "" {- err := db.StoreDescription(&db.ConvoMessageDescription{- OrgId: currentOrgId,- PlanId: planId,- SummarizedToMessageId: summarizedToMessageId,- MadePlan: false,- ConvoMessageId: convoMessageId,- BuildPathsInvalidated: map[string]bool{},- Error: streamErr.Error(),- })- if err == nil {- storedDesc = true- } else {- log.Printf("Error storing description after stream error: %v\n", err)+ storedMessage := false+ storedDesc := false++ if convoMessageId == "" {+ assistantMsg, msg, err := state.storeAssistantReply()+ if err == nil {+ convoMessageId = assistantMsg.Id+ commitMsg = msg+ storedMessage = true+ } else {+ log.Printf("Error storing assistant message after stream error: %v\n", err)+ }}- }- if storedMessage || storedDesc {- err := db.GitAddAndCommit(currentOrgId, planId, branch, commitMsg)- if err != nil {- log.Printf("Error committing after stream error: %v\n", err)+ if storeDesc && convoMessageId != "" {+ err := db.StoreDescription(&db.ConvoMessageDescription{+ OrgId: currentOrgId,+ PlanId: planId,+ SummarizedToMessageId: summarizedToMessageId,+ MadePlan: false,+ ConvoMessageId: convoMessageId,+ BuildPathsInvalidated: map[string]bool{},+ Error: streamErr.Error(),+ })+ if err == nil {+ storedDesc = true+ } else {+ log.Printf("Error storing description after stream error: %v\n", err)+ }}++ if storedMessage || storedDesc {+ err := db.GitAddAndCommit(currentOrgId, planId, branch, commitMsg)+ if err != nil {+ log.Printf("Error committing after stream error: %v\n", err)+ }+ }+ }++ storeDescAndReply()++ active.StreamDoneCh <- &shared.ApiError{+ Type: shared.ApiErrorTypeOther,+ Status: http.StatusInternalServerError,+ Msg: "Stream error: " + streamErr.Error(),}}diff --git a/releases/server/versions/0.9.1.md b/releases/server/versions/0.9.1.mdindex 4c2fa328..8269b62a 100644--- a/releases/server/versions/0.9.1.md+++ b/releases/server/versions/0.9.1.md@@ -1,2 +1,3 @@-- Added an auto-verify and auto-fix step to plan builds to improve reliability and reduce syntax errors, mistaken duplication or removal of code, and other similar issues.-- Improvements to auto-continue check. It should now do a better job determining whether a plan is finished or should automatically continue.\ No newline at end of file+- Added an auto-verify and auto-fix step to plan builds to improve reliability and reduce syntax errors, mistaken duplication or removal of code, and other similar issues.+- Improvements to auto-continue check. It should now do a better job determining whether a plan is finished or should automatically continue.+- Fix for 'exit status 128' errors in a couple of edge case scenarios.\ No newline at end of file