fix(ax): use Result-native status writes

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-03-30 19:32:29 +00:00 committed by Snider
parent e9db636552
commit f3b70fcdfb
10 changed files with 17 additions and 17 deletions

View file

@ -192,7 +192,7 @@ func (s *PrepSubsystem) handleQA(ctx context.Context, opts core.Options) core.Re
if st, err := ReadStatus(wsDir); err == nil {
st.Status = "failed"
st.Question = "QA check failed — build or tests did not pass"
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
}
}
// Emit QA result for observability (monitor picks this up)

View file

@ -45,7 +45,7 @@ func (s *PrepSubsystem) autoCreatePR(wsDir string) {
if !process.RunIn(ctx, repoDir, "git", "push", forgeRemote, st.Branch).OK {
if st2, err := ReadStatus(wsDir); err == nil {
st2.Question = "PR push failed"
writeStatus(wsDir, st2)
writeStatusResult(wsDir, st2)
}
return
}
@ -61,7 +61,7 @@ func (s *PrepSubsystem) autoCreatePR(wsDir string) {
if err != nil {
if st2, err := ReadStatus(wsDir); err == nil {
st2.Question = core.Sprintf("PR creation failed: %v", err)
writeStatus(wsDir, st2)
writeStatusResult(wsDir, st2)
}
return
}
@ -69,7 +69,7 @@ func (s *PrepSubsystem) autoCreatePR(wsDir string) {
// Update status with PR URL
if st2, err := ReadStatus(wsDir); err == nil {
st2.PRURL = prURL
writeStatus(wsDir, st2)
writeStatusResult(wsDir, st2)
}
}

View file

@ -358,7 +358,7 @@ func (s *PrepSubsystem) onAgentComplete(agent, wsDir, outputFile string, exitCod
st.Status = finalStatus
st.PID = 0
st.Question = question
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
s.TrackWorkspace(WorkspaceName(wsDir), st)
}
@ -580,7 +580,7 @@ func (s *PrepSubsystem) dispatch(ctx context.Context, req *mcp.CallToolRequest,
StartedAt: time.Now(),
Runs: 0,
}
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
if runnerSvc, ok := core.ServiceFor[workspaceTracker](s.Core(), "runner"); ok {
runnerSvc.TrackWorkspace(WorkspaceName(wsDir), st)
}
@ -612,7 +612,7 @@ func (s *PrepSubsystem) dispatch(ctx context.Context, req *mcp.CallToolRequest,
StartedAt: time.Now(),
Runs: 1,
}
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
// Track in runner's registry (runner owns workspace state)
if s.ServiceRuntime != nil {
if runnerSvc, ok := core.ServiceFor[workspaceTracker](s.Core(), "runner"); ok {

View file

@ -41,7 +41,7 @@ func (s *PrepSubsystem) HandleIPCEvents(c *core.Core, msg core.Message) core.Res
if st, serr := ReadStatus(wsDir); serr == nil {
st.PID = pid
st.ProcessID = processID
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
if runnerSvc, ok := core.ServiceFor[workspaceTracker](c, "runner"); ok {
runnerSvc.TrackWorkspace(WorkspaceName(wsDir), st)
}

View file

@ -13,7 +13,7 @@ import (
// Plan represents an implementation plan for agent work.
//
// plan := &Plan{ID: "id-1-a3f2b1", Title: "Migrate Core", Status: "draft", Objective: "..."}
// writePlan(PlansRoot(), plan)
// r := writePlanResult(PlansRoot(), plan)
type Plan struct {
ID string `json:"id"`
Title string `json:"title"`

View file

@ -124,7 +124,7 @@ func (s *PrepSubsystem) createPR(ctx context.Context, _ *mcp.CallToolRequest, in
// Update status with PR URL
st.PRURL = prURL
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
// Comment on issue if tracked
if st.Issue > 0 {

View file

@ -363,7 +363,7 @@ func (s *PrepSubsystem) drainOne() bool {
st.PID = pid
st.ProcessID = processID
st.Runs++
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
s.TrackWorkspace(WorkspaceName(wsDir), st)
return true

View file

@ -105,7 +105,7 @@ func (s *PrepSubsystem) resume(ctx context.Context, _ *mcp.CallToolRequest, inpu
st.ProcessID = processID
st.Runs++
st.Question = ""
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
return nil, ResumeOutput{
Success: true,

View file

@ -26,8 +26,8 @@ import (
// WorkspaceStatus represents the current state of an agent workspace.
//
// st, err := ReadStatus(wsDir)
// if err == nil && st.Status == "completed" { autoCreatePR(wsDir) }
// r := ReadStatusResult(wsDir)
// if r.OK && r.Value.(*WorkspaceStatus).Status == "completed" { autoCreatePR(wsDir) }
type WorkspaceStatus struct {
Status string `json:"status"` // running, completed, blocked, failed
Agent string `json:"agent"` // gemini, claude, codex
@ -212,7 +212,7 @@ func (s *PrepSubsystem) status(ctx context.Context, _ *mcp.CallToolRequest, inpu
st.Status = "completed"
}
}
writeStatus(wsDir, st)
writeStatusResult(wsDir, st)
}
}

View file

@ -37,7 +37,7 @@ func (s *PrepSubsystem) autoVerifyAndMerge(wsDir string) {
markMerged := func() {
if st2, err := ReadStatus(wsDir); err == nil {
st2.Status = "merged"
writeStatus(wsDir, st2)
writeStatusResult(wsDir, st2)
}
}
@ -63,7 +63,7 @@ func (s *PrepSubsystem) autoVerifyAndMerge(wsDir string) {
if st2, err := ReadStatus(wsDir); err == nil {
st2.Question = "Flagged for review — auto-merge failed after retry"
writeStatus(wsDir, st2)
writeStatusResult(wsDir, st2)
}
}