Skip to content

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

feat: add AutoLoaded flag to context loading system

Dane Schneiderbbebf887a987
diff --git a/app/cli/types/types.go b/app/cli/types/types.go
index 314ed094..3fadcbca 100644
--- a/app/cli/types/types.go
+++ b/app/cli/types/types.go
@@ -14,6 +14,7 @@ type LoadContextParams struct {
ImageDetail openai.ImageURLDetail
DefsOnly bool
SkipIgnoreWarning bool
+ AutoLoaded bool
}
type ContextOutdatedResult struct {
diff --git a/app/server/db/context_helpers.go b/app/server/db/context_helpers.go
index 1f180089..e393a66c 100644
--- a/app/server/db/context_helpers.go
+++ b/app/server/db/context_helpers.go
@@ -555,6 +555,10 @@ func LoadContexts(ctx Ctx, params LoadContextsParams) (*shared.LoadContextRespon
combinedBody := mappedFiles.CombinedMap()
numTokens = shared.GetNumTokensEstimate(combinedBody)
+ autoLoaded = autoLoaded || context.AutoLoaded
+
+ log.Println("LoadContexts - map - autoLoaded", autoLoaded)
+
newContext := Context{
// Id generated by db layer
OrgId: orgId,
@@ -570,7 +574,7 @@ func LoadContexts(ctx Ctx, params LoadContextsParams) (*shared.LoadContextRespon
MapParts: mappedFiles,
MapShas: mapShas,
MapTokens: mapTokens,
- AutoLoaded: autoLoaded,
+ AutoLoaded: autoLoaded || context.AutoLoaded,
}
mapContextsByFilePath[context.FilePath] = newContext
@@ -666,7 +670,7 @@ func LoadContexts(ctx Ctx, params LoadContextsParams) (*shared.LoadContextRespon
Body: loadParams.Body,
ForceSkipIgnore: loadParams.ForceSkipIgnore,
ImageDetail: loadParams.ImageDetail,
- AutoLoaded: autoLoaded,
+ AutoLoaded: autoLoaded || loadParams.AutoLoaded,
}
}
diff --git a/app/server/handlers/plans_exec.go b/app/server/handlers/plans_exec.go
index b2243c0c..537b862e 100644
--- a/app/server/handlers/plans_exec.go
+++ b/app/server/handlers/plans_exec.go
@@ -444,6 +444,8 @@ func AutoLoadContextHandler(w http.ResponseWriter, r *http.Request) {
}
})
+ log.Println("AutoLoadContextHandler - updated active plan")
+
var apiContexts []*shared.Context
for _, dbContext := range dbContexts {
apiContexts = append(apiContexts, dbContext.ToApi())