After a bool operation between sphere face and box, seam edge makes error

I want to perform a Boolean operation between a TopoDS_Face of a sphere and a TopoDS_Shape of a cube located at the top of the sphere. I use BRepAlgoAPI_Common to perform a Boolean intersection operation between the face and the shape, obtaining the portion of the face that is clipped. The sphere contains only one face, so there are sewing edges. After performing the Boolean intersection operation, the resulting face has an incorrect topology. Even after using the ShapeUpgrade_UnifySameDomain function for repair, the topology is still incorrect. What function should I use to make the topology of the face resulting from the Boolean intersection operation correct? I visualiaze the cut face and edge, it has wrong edge topology. I use the code like this:

    const double boxSize = 0.6;
    gp_Pnt northPole(0, 0, 1); 
    gp_Pnt boxCorner(northPole.X() - boxSize / 2, northPole.Y() - boxSize / 2, northPole.Z() - boxSize / 2);
    BRepPrimAPI_MakeBox boxMaker(boxCorner, boxSize, boxSize, boxSize);
    TopoDS_Shape box = boxMaker.Shape();
    TopoDS_Shape sphere;
    if (!ReadStepFile(argv[1], sphere))
    {
        std::cout << "unable to read step file\n";
        exit(-1);
    }
    TopoDS_Face resultFace;
    for (TopExp_Explorer explorer(sphere, TopAbs_FACE); explorer.More(); explorer.Next())
    {
        TopoDS_Face face = TopoDS::Face(explorer.Current());
        BRepAlgoAPI_Common commonAlgo(box, face);
        commonAlgo.Build();
        if (commonAlgo.IsDone())
        {
            ShapeUpgrade_UnifySameDomain faceUnifier(commonAlgo.Shape(), true, true, true);
            faceUnifier.SetLinearTolerance(1e-5); 
            faceUnifier.SetAngularTolerance(1e-5);
            faceUnifier.Build();
            TopoDS_Shape finalShape = faceUnifier.Shape();
            for (TopExp_Explorer faceExp(finalShape, TopAbs_FACE); faceExp.More(); faceExp.Next())
            {
                TopoDS_Face faceCut = TopoDS::Face(faceExp.Current());
                resultFace = faceCut;
            }
        }
        else
        {
            std::cout << "error\n";
        }
    }
Attachments: