Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ proto:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/ax.proto proto/content.proto
@python3 -m grpc_tools.protoc -I. --python_out=python --grpc_python_out=python proto/ax.proto proto/content.proto
@echo "Protobuf generation complete!"

# Run tests
Expand Down
7 changes: 6 additions & 1 deletion cmd/ax/harnessclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ func runHarnessClient(cmd *cobra.Command, args []string) error {
fmt.Printf("Server > message[%d] (%s): %s\n", i, m.Role, text)
}
case *proto.HarnessResponse_End:
fmt.Printf("Server > [end] state=%s %s\n", payload.End.GetState(), payload.End.GetErrorMessage())
if errDetail := payload.End.GetError(); errDetail != nil {
fmt.Printf("Server > [end] state=%s error=(code=%d description=%q)\n",
payload.End.GetState(), errDetail.GetCode(), errDetail.GetDescription())
} else {
fmt.Printf("Server > [end] state=%s\n", payload.End.GetState())
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion internal/harness/antigravity.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ func (e *antigravityExecution) Run(ctx context.Context, handler Handler) error {
}
case *proto.HarnessResponse_End:
if payload.End.GetState() == proto.State_STATE_FAILED {
return fmt.Errorf("harness failed: %s", payload.End.GetErrorMessage())
if errDetail := payload.End.GetError(); errDetail != nil {
return fmt.Errorf("harness failed: [%d] %s", errDetail.GetCode(), errDetail.GetDescription())
}
return fmt.Errorf("harness failed with no error details")
}
return handler.OnComplete(ctx, e.id)
}
Expand Down
10 changes: 9 additions & 1 deletion internal/harness/mocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ type mockHarnessServer struct {
failConnect bool
// failFrame makes Connect terminate the turn with HarnessEnd{STATE_FAILED}.
failFrame bool
// errCode is the error code used by failFrame.
errCode int32
// errMessage is the error text used by failConnect/failFrame.
errMessage string

Expand Down Expand Up @@ -138,7 +140,13 @@ func (s *mockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e
return stream.Send(&proto.HarnessResponse{
ConversationId: convID,
Type: &proto.HarnessResponse_End{
End: &proto.HarnessEnd{State: proto.State_STATE_FAILED, ErrorMessage: s.errMessage},
End: &proto.HarnessEnd{
State: proto.State_STATE_FAILED,
Error: &proto.Error{
Code: s.errCode,
Description: s.errMessage,
},
},
},
})
}
Expand Down
5 changes: 4 additions & 1 deletion internal/harness/substrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ func (e *substrateExecution) Run(ctx context.Context, handler Handler) error {
}
case *proto.HarnessResponse_End:
if payload.End.GetState() == proto.State_STATE_FAILED {
return fmt.Errorf("harness failed: %s", payload.End.GetErrorMessage())
if errDetail := payload.End.GetError(); errDetail != nil {
return fmt.Errorf("harness failed: [%d] %s", errDetail.GetCode(), errDetail.GetDescription())
}
return fmt.Errorf("harness failed with no error details")
}
return handler.OnComplete(ctx, e.execID)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/harness/substrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func TestSubstrateHarness_ResumeNilActor(t *testing.T) {

func TestSubstrateHarness_HarnessFailedFrame(t *testing.T) {
ctrl := &mockControlServer{resumeIP: "127.0.0.1"}
srv := &mockHarnessServer{failFrame: true, errMessage: "boom"}
srv := &mockHarnessServer{failFrame: true, errCode: 13, errMessage: "boom"}
h := newTestSubstrateHarness(t, startControlServer(t, ctrl), startHarnessServer(t, srv))

ctx := context.Background()
Expand Down
Loading
Loading