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
[44;97;1m π€ Plandex [0;0;22m π Refactor Tell function and add logging for error handling βοΈ Edits: β’ app/server/model/plan/tell.go β Add detailed logging for Tell function call with plan ID and branch β Add logging for active plan found in Tell function β Add logging for active model stream found in Tell function β Add logging for error storing model stream in Tell function β Add logging for successful storage of model stream in Tell function β Add detailed logging for successful completion of Tell operation β Add detailed logging for execTellPlan function call with plan ID, branch, and iteration β Add logging for IS_CLOUD environment variable check in execTellPlan function β Add detailed logging for completion of execTellPlan operation β Add detailed logging for error locking repo in execTellPlan function β Add detailed logging for summarizeConvo function call with plan ID and branch β Add detailed logging for error generating summary in summarizeConvo function β Add detailed logging for successful generation and storage of summary in summarizeConvo function
Dane Schneider6df8c9cde109
diff --git a/app/server/model/plan/tell.go b/app/server/model/plan/tell.goindex 7e7eb7f6..c9c9b87f 100644--- a/app/server/model/plan/tell.go+++ b/app/server/model/plan/tell.go@@ -23,6 +23,7 @@ import ()func Tell(client *openai.Client, plan *db.Plan, branch string, auth *types.ServerAuth, req *shared.TellPlanRequest) error {+ log.Printf("Tell: Called with plan ID %s on branch %s\n", plan.Id, branch) // Log the function call with plan ID and branchlog.Println("Tell: Starting Tell operation") // Log start of Tell operation// goEnv := os.Getenv("GOENV") // Fetch the GOENV environment variable@@ -34,6 +35,7 @@ func Tell(client *openai.Client, plan *db.Plan, branch string, auth *types.Serveactive := GetActivePlan(plan.Id, branch)if active != nil {+ log.Printf("Tell: Active plan found for plan ID %s on branch %s\n", plan.Id, branch) // Log if an active plan is foundreturn fmt.Errorf("plan %s branch %s already has an active stream on this host", plan.Id, branch)}@@ -44,6 +46,7 @@ func Tell(client *openai.Client, plan *db.Plan, branch string, auth *types.Serve}if modelStream != nil {+ log.Printf("Tell: Active model stream found for plan ID %s on branch %s on host %s\n", plan.Id, branch, modelStream.InternalIp) // Log if an active model stream is foundreturn fmt.Errorf("plan %s branch %s already has an active stream on host %s", plan.Id, branch, modelStream.InternalIp)}@@ -56,8 +59,8 @@ func Tell(client *openai.Client, plan *db.Plan, branch string, auth *types.ServeBranch: branch,}err = db.StoreModelStream(modelStream)-if err != nil {+ log.Printf("Tell: Error storing model stream for plan ID %s on branch %s: %v\n", plan.Id, branch, err) // Log error storing model streamlog.Printf("Error storing model stream: %v\n", err)log.Printf("Tell: Error storing model stream: %v\n", err) // Log error storing model streamreturn fmt.Errorf("error storing model stream: %v", err)@@ -65,21 +68,24 @@ func Tell(client *openai.Client, plan *db.Plan, branch string, auth *types.Serveactive.ModelStreamId = modelStream.Id+ log.Printf("Tell: Model stream stored with ID %s for plan ID %s on branch %s\n", modelStream.Id, plan.Id, branch) // Log successful storage of model streamlog.Println("Model stream id:", modelStream.Id)go execTellPlan(client, plan, branch, auth, req, active, 0, "")- log.Println("Tell: Tell operation completed successfully") // Log successful completion of Tell operation+ log.Printf("Tell: Tell operation completed successfully for plan ID %s on branch %s\n", plan.Id, branch) // Log successful completion of Tell operationreturn nil}func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *types.ServerAuth, req *shared.TellPlanRequest, active *types.ActivePlan, iteration int, missingFileResponse shared.RespondMissingFileChoice) {+ log.Printf("execTellPlan: Called for plan ID %s on branch %s, iteration %d\n", plan.Id, branch, iteration) // Log the function call with plan ID, branch, and iterationlog.Printf("execTellPlan: Starting execTellPlan operation, iteration: %d\n", iteration) // Log start of execTellPlan operationcurrentUserId := auth.User.IdcurrentOrgId := auth.OrgIdif os.Getenv("IS_CLOUD") != "" &&missingFileResponse == "" {+ log.Println("execTellPlan: IS_CLOUD environment variable is set") // Log check for IS_CLOUD environment variableif auth.User.IsTrial {if plan.TotalReplies >= types.TrialMaxReplies {active.StreamDoneCh <- &shared.ApiError{@@ -105,7 +111,7 @@ func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *typMsg: "Error setting plan status to replying",}- log.Printf("execTellPlan: execTellPlan operation completed, iteration: %d\n", iteration) // Log completion of execTellPlan operation+ log.Printf("execTellPlan: execTellPlan operation completed for plan ID %s on branch %s, iteration %d\n", plan.Id, branch, iteration) // Log completion of execTellPlan operationreturn}@@ -116,7 +122,7 @@ func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *typrepoLockId, err := db.LockRepo(auth.OrgId, auth.User.Id, planId, branch, lockScope)if err != nil {- log.Printf("Error locking repo: %v\n", err)+ log.Printf("execTellPlan: Error locking repo for plan ID %s on branch %s: %v\n", plan.Id, branch, err) // Log error locking repoactive.StreamDoneCh <- &shared.ApiError{Type: shared.ApiErrorTypeOther,Status: http.StatusInternalServerError,@@ -932,6 +938,7 @@ type summarizeConvoParams struct {}func summarizeConvo(client *openai.Client, params summarizeConvoParams) error {+ log.Printf("summarizeConvo: Called for plan ID %s on branch %s\n", params.planId, params.branch) // Log the function call with plan ID and branchlog.Printf("summarizeConvo: Starting summarizeConvo for planId: %s\n", params.planId) // Log start of summarizeConvoplanId := params.planIdbranch := params.branch@@ -1007,12 +1014,12 @@ func summarizeConvo(client *openai.Client, params summarizeConvoParams) error {})if err != nil {- log.Printf("Error generating plan summary for plan %s: %v\n", planId, err)+ log.Printf("summarizeConvo: Error generating summary for plan ID %s: %v\n", params.planId, err) // Log error generating summarylog.Printf("summarizeConvo: Error generating plan summary for plan %s: %v\n", params.planId, err) // Log error generating plan summaryreturn err}- log.Println("Generated plan summary for plan", planId)+ log.Printf("summarizeConvo: Summary generated and stored for plan ID %s\n", params.planId) // Log successful generation and storage of summaryerr = db.StoreSummary(summary)