Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

some logging cleanup, as well as additional logging around streamed token limit for retries in builds

Dane Schneider2d50e6a839d8
diff --git a/app/cli/api/methods.go b/app/cli/api/methods.go
index 9c11804e..5e18c2a1 100644
--- a/app/cli/api/methods.go
+++ b/app/cli/api/methods.go
@@ -1568,7 +1568,7 @@ func (a *Api) UpdateSettings(planId, branch string, req shared.UpdateSettingsReq
return nil, &shared.ApiError{Type: shared.ApiErrorTypeOther, Msg: fmt.Sprintf("error marshalling request: %s", err)}
}
- log.Println("UpdateSettings", string(reqBytes))
+ // log.Println("UpdateSettings", string(reqBytes))
request, err := http.NewRequest(http.MethodPut, serverUrl, bytes.NewBuffer(reqBytes))
if err != nil {
diff --git a/app/server/db/org_helpers.go b/app/server/db/org_helpers.go
index d1442ca7..081096ec 100644
--- a/app/server/db/org_helpers.go
+++ b/app/server/db/org_helpers.go
@@ -6,7 +6,6 @@ import (
"log"
"strings"
- "github.com/davecgh/go-spew/spew"
"github.com/lib/pq"
"github.com/plandex/plandex/shared"
)
@@ -50,7 +49,7 @@ func GetAccessibleOrgsForUser(user *User) ([]*Org, error) {
orgIds = append(orgIds, invite.OrgId)
}
- log.Println(spew.Sdump(orgIds))
+ // log.Println(spew.Sdump(orgIds))
if len(orgIds) > 0 {
var orgsFromInvites []*Org
diff --git a/app/server/model/plan/build_result.go b/app/server/model/plan/build_result.go
index e73f5974..aaa46333 100644
--- a/app/server/model/plan/build_result.go
+++ b/app/server/model/plan/build_result.go
@@ -1,7 +1,6 @@
package plan
import (
- "log"
"plandex-server/db"
"sort"
"strings"
@@ -48,8 +47,8 @@ func getPlanResult(params planResultParams) (*db.PlanFileResult, bool) {
new := streamedChange.New
- log.Printf("getPlanResult - streamedChange.Old.StartLine: %d\n", streamedChange.Old.StartLine)
- log.Printf("getPlanResult - streamedChange.Old.EndLine: %d\n", streamedChange.Old.EndLine)
+ // log.Printf("getPlanResult - streamedChange.Old.StartLine: %d\n", streamedChange.Old.StartLine)
+ // log.Printf("getPlanResult - streamedChange.Old.EndLine: %d\n", streamedChange.Old.EndLine)
startLine := streamedChange.Old.StartLine
endLine := streamedChange.Old.EndLine
@@ -74,7 +73,7 @@ func getPlanResult(params planResultParams) (*db.PlanFileResult, bool) {
old = strings.Join(currentStateLines[startLine-1:endLine], "\n")
}
- log.Printf("getPlanResult - old: %s\n", old)
+ // log.Printf("getPlanResult - old: %s\n", old)
replacement := &shared.Replacement{
Old: old,
diff --git a/app/server/model/plan/build_stream.go b/app/server/model/plan/build_stream.go
index f0c0784d..03534bbe 100644
--- a/app/server/model/plan/build_stream.go
+++ b/app/server/model/plan/build_stream.go
@@ -126,6 +126,14 @@ func (fileState *activeBuildStreamFileState) listenStream(stream *openai.ChatCom
// After a reasonable threshhold, if buffer has significantly more tokens than original file + proposed changes, something is wrong
if fileState.activeBuild.BufferTokens > 500 && fileState.activeBuild.BufferTokens > int(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens)*1.5) {
+ log.Printf("File %s: Stream buffer tokens too high\n", filePath)
+ log.Printf("Current file tokens: %d\n", fileState.activeBuild.CurrentFileTokens)
+ log.Printf("File content tokens: %d\n", fileState.activeBuild.FileContentTokens)
+ log.Printf("Cutoff: %d\n", int(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens)*1.5))
+ log.Printf("Buffer tokens: %d\n", fileState.activeBuild.BufferTokens)
+ log.Println("Buffer:")
+ log.Println(fileState.activeBuild.Buffer)
+
fileState.retryOrError(fmt.Errorf("stream buffer tokens too high for file '%s'", filePath))
return
}