Conversation
- startCodebaseServer启动后轮询/health最多30s,未就绪则kill进程 - repo_operations.go提取doCodebaseRequest辅助函数,3次重试(500ms退避) - RepoAgent.doPreInvestigate添加3次重试 - 删除task_executor.go中废弃的codebase_init注释代码 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Expand Repo-Agent description to include codebase semantic tools (semantic_search, query_code_skeleton, query_code_snippet) - Add guidance for Phase 1 context gathering to leverage semantic search - Strengthen rule 5: make Repo-Agent the primary agent for all repo exploration, demoting Conductor's own file tools to fallback-only
Reviewer's GuideAdds reusable HTTP+retry helpers for the codebase service, applies them across RepoOperationsTool and RepoAgent, introduces health checking for the codebase server startup, and strengthens Conductor/Repo-Agent documentation to prioritize semantic codebase tools while cleaning up unused code. Sequence diagram for RepoOperationsTool.doCodebaseRequest with retry logicsequenceDiagram
participant Caller as RepoOperationsTool_method
participant RepoOperationsTool
participant HTTPClient as http_Client
participant CodebaseService
Caller->>RepoOperationsTool: doCodebaseRequest(endpoint, body)
RepoOperationsTool->>RepoOperationsTool: json.Marshal(body)
alt marshal fails
RepoOperationsTool-->>Caller: error
else marshal ok
loop up to 3 attempts
RepoOperationsTool->>RepoOperationsTool: build URL CodebaseURL+endpoint
RepoOperationsTool->>HTTPClient: http.NewRequest(POST, URL, bodyBytes)
alt request creation fails
RepoOperationsTool-->>Caller: error
else request ok
HTTPClient->>CodebaseService: POST endpoint
alt network error
HTTPClient-->>RepoOperationsTool: error
RepoOperationsTool->>RepoOperationsTool: lastErr = send error
else response received
CodebaseService-->>HTTPClient: HTTP response
HTTPClient-->>RepoOperationsTool: response
RepoOperationsTool->>RepoOperationsTool: io.ReadAll(resp.Body)
alt read error
RepoOperationsTool->>RepoOperationsTool: lastErr = read error
else body ok
alt status != 200
RepoOperationsTool->>RepoOperationsTool: lastErr = status error
else status == 200
RepoOperationsTool-->>Caller: response body
end
end
end
opt need another attempt
RepoOperationsTool->>RepoOperationsTool: sleep(backoff)
end
end
end
alt all attempts failed
RepoOperationsTool-->>Caller: error with lastErr
end
end
Sequence diagram for startCodebaseServer and waitForCodebase health checkssequenceDiagram
actor User
participant MainProcess
participant CodebaseServer as codeactor_codebase
participant HealthClient as nethttp_Client
User->>MainProcess: startCodebaseServer(port, repoPath)
MainProcess->>MainProcess: build command and args
MainProcess->>CodebaseServer: start process
CodebaseServer-->>MainProcess: pid
MainProcess->>MainProcess: waitForCodebase(address, timeout)
MainProcess->>HealthClient: GET http://address/health
loop until timeout or healthy
alt network error
HealthClient-->>MainProcess: error
MainProcess->>MainProcess: lastErr = error
MainProcess->>MainProcess: sleep(500ms)
MainProcess->>HealthClient: GET /health
else response received
HealthClient-->>MainProcess: response
alt status == 200
MainProcess->>MainProcess: log healthy
MainProcess-->>User: cmd (ready)
else status != 200
MainProcess->>MainProcess: lastErr = status error
MainProcess->>MainProcess: sleep(500ms)
MainProcess->>HealthClient: GET /health
end
end
end
alt deadline exceeded and not healthy
MainProcess-->>User: error
MainProcess->>CodebaseServer: kill process
end
Class diagram for RepoOperationsTool and RepoAgent retry-enabled HTTP interactionsclassDiagram
class RepoOperationsTool {
string CodebaseURL
string ProjectPath
NewRepoOperationsTool(codebaseURL string, projectPath string) RepoOperationsTool
doCodebaseRequest(endpoint string, body interface_any) []byte
ExecuteSemanticSearch(ctx context_Context, params map_string_interface) (interface, error)
ExecuteQueryCodeSkeleton(ctx context_Context, params map_string_interface) (interface, error)
ExecuteQueryCodeSnippet(ctx context_Context, params map_string_interface) (interface, error)
}
class RepoAgent {
GlobalCtx globalctx_GlobalContext
TaskManagerPtr *TaskManager
Name() string
doPreInvestigate(projectDir string) (*PreInvestigateResponse, error)
Run(ctx context_Context, input string) (string, error)
}
class PreInvestigateResponse {
bool Success
string Message
string OtherFields_information
}
RepoAgent --> PreInvestigateResponse : uses
class CodebaseServiceEndpoints {
investigate_repo
semantic_search
query_code_skeleton
query_code_snippet
}
RepoOperationsTool --> CodebaseServiceEndpoints : HTTP POST with retry
RepoAgent --> CodebaseServiceEndpoints : HTTP POST with retry
class MainProcess {
startCodebaseServer(port int, repoPath string) *exec_Cmd
waitForCodebase(address string, timeout time_Duration) error
}
MainProcess --> CodebaseServiceEndpoints : manages lifecycle and health
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In both
doCodebaseRequestandRepoAgent.doPreInvestigate, thecontext.Contextpassed into the public methods is ignored—consider usinghttp.NewRequestWithContextand/or a sharedhttp.Clientwith timeouts so callers can cancel or bound these network operations. internal/agents/repo.gonow usesbytes.NewReader(jsonData)but thebytespackage is not imported (you only replacedstringswithtime), which will cause a compile error—add thebytesimport or adjust the request body creation.- The retry logic for HTTP POSTs is now implemented separately in
doCodebaseRequestandRepoAgent.doPreInvestigate; consider extracting a shared helper or reusingdoCodebaseRequestforinvestigate_repoto avoid divergence in backoff behavior and error handling.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In both `doCodebaseRequest` and `RepoAgent.doPreInvestigate`, the `context.Context` passed into the public methods is ignored—consider using `http.NewRequestWithContext` and/or a shared `http.Client` with timeouts so callers can cancel or bound these network operations.
- `internal/agents/repo.go` now uses `bytes.NewReader(jsonData)` but the `bytes` package is not imported (you only replaced `strings` with `time`), which will cause a compile error—add the `bytes` import or adjust the request body creation.
- The retry logic for HTTP POSTs is now implemented separately in `doCodebaseRequest` and `RepoAgent.doPreInvestigate`; consider extracting a shared helper or reusing `doCodebaseRequest` for `investigate_repo` to avoid divergence in backoff behavior and error handling.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Introduce robust HTTP retry handling and health checks for codebase service interactions and clarify Repo-Agent’s role and capabilities in the multi-agent conductor prompt.
Enhancements: