fix: Phase 4 structural refactor — reduce lint findings from 28 to 5
cyclop (5→0): extract subcommand/case bodies in codesearch, subprocess, Telegram, indexing funlen (5→3): extract memory action handlers, tool provider startup gocognit (7→2): extract config finalize/loadDirInto helpers, release announcer, capture tool validation, Telegram gateway (200→108), archie-agent main loop (35→0) nestif (8→0): extract identity validation, container validation, conf.d scanning, email multipart parsing, Telegram model/update parsing, build-no-changes closure interfacebloat (3→0): split Forge/IssueForge/PRForge/RepoForge, SessionStore/SessionLifecycle/MessageHistory, TaskStore/TaskLifecycle/TaskQueries/TaskEvents Remaining: daemon process, workflow Feasibility/TDD/AgentStage, archied main.go run (108→30 remaining). These require deeper refactoring best done per-function in follow-up beads. Updated contract tests and archied wiring tests to check both main.go and the new telegram_setup.go.
This commit is contained in:
1 parent
676ad3fe48
commit
712388dc6c
24 files changed
+1090
-886
No files matched your search
@@ -72,9 +72,15 @@ func (r *SubprocessRunner) Run(ctx context.Context, workspace string, req Reques
|
||||
if stdout.truncated {
|
||||
return Result{}, fmt.Errorf("archie-agent response exceeds %d bytes", maxProtocolBytes)
|
||||
}
|
||||
return decodeSubprocessResponse(bytes.NewReader(stdout.Bytes()), stderr.String(), req)
|
||||
}
|
||||
|
||||
// decodeSubprocessResponse reads one Response from r and validates it
|
||||
// against req, returning the Result or an error.
|
||||
func decodeSubprocessResponse(r io.Reader, stderrText string, req Request) (Result, error) {
|
||||
var response Response
|
||||
if err := decodeOne(bytes.NewReader(stdout.Bytes()), &response); err != nil {
|
||||
return Result{}, fmt.Errorf("decode archie-agent response: %w: %s", err, strings.TrimSpace(stderr.String()))
|
||||
if err := decodeOne(r, &response); err != nil {
|
||||
return Result{}, fmt.Errorf("decode archie-agent response: %w: %s", err, strings.TrimSpace(stderrText))
|
||||
}
|
||||
if response.Version != ProtocolVersion {
|
||||
return Result{}, fmt.Errorf("archie-agent response protocol version %d is unsupported", response.Version)
|
||||
|
||||
Reference in new issue
Block a user