@triflux/remote 10.26.0 → 10.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -655,6 +655,9 @@ export async function startNativeWorkerFacade({
|
|
|
655
655
|
events.push({ type: "rv-connect" });
|
|
656
656
|
socket.setEncoding("utf8");
|
|
657
657
|
socket.once("close", () => rvSockets.delete(socket));
|
|
658
|
+
socket.on("error", (error) => {
|
|
659
|
+
events.push({ type: "rv-socket-error", message: error.message });
|
|
660
|
+
});
|
|
658
661
|
writeJsonLine(socket, { type: "heartbeat" });
|
|
659
662
|
writeJsonLine(socket, { type: "state", patch: state });
|
|
660
663
|
socket.on("data", (chunk) => {
|
|
@@ -690,6 +693,9 @@ export async function startNativeWorkerFacade({
|
|
|
690
693
|
ptySockets.add(socket);
|
|
691
694
|
events.push({ type: "pty-connect" });
|
|
692
695
|
socket.once("close", () => ptySockets.delete(socket));
|
|
696
|
+
socket.on("error", (error) => {
|
|
697
|
+
events.push({ type: "pty-socket-error", message: error.message });
|
|
698
|
+
});
|
|
693
699
|
socket.write(buildPtyControlFrame({ t: "hello", replPid: pid, version }));
|
|
694
700
|
if (transcript.length > 0) socket.write(buildPtyDataFrame(transcript));
|
|
695
701
|
socket.write(buildPtyControlFrame({ t: "live" }));
|
|
@@ -903,26 +903,45 @@ export function createSwarmHypervisor(opts) {
|
|
|
903
903
|
const completedWorker = isRedundant
|
|
904
904
|
? redundantWorkers.get(shardName)
|
|
905
905
|
: workers.get(shardName);
|
|
906
|
-
if (completedWorker) {
|
|
907
|
-
void closeNativeBridgeRegistration(
|
|
908
|
-
completedWorker,
|
|
909
|
-
shardName,
|
|
910
|
-
"completed",
|
|
911
|
-
);
|
|
912
|
-
}
|
|
913
906
|
|
|
914
907
|
// F7 — worker self-reported completion must include commits_made.
|
|
915
908
|
// Only enforce when payload is actually provided; legacy workers that
|
|
916
909
|
// don't emit a structured payload keep the F6 integration-time guard.
|
|
917
|
-
if (
|
|
910
|
+
if (completionPayload !== undefined) {
|
|
918
911
|
const verdict = validateWorkerCompletion(completionPayload);
|
|
919
912
|
if (!verdict.ok) {
|
|
920
913
|
const reason = verdict.reason || "invalid_completion_payload";
|
|
914
|
+
|
|
915
|
+
if (isRedundant) {
|
|
916
|
+
eventLog.append("redundant_completion_rejected", {
|
|
917
|
+
shard: shardName,
|
|
918
|
+
sessionId,
|
|
919
|
+
reason,
|
|
920
|
+
});
|
|
921
|
+
redundantWorkers.delete(shardName);
|
|
922
|
+
if (completedWorker) {
|
|
923
|
+
void closeNativeBridgeRegistration(
|
|
924
|
+
completedWorker,
|
|
925
|
+
shardName,
|
|
926
|
+
"failed",
|
|
927
|
+
);
|
|
928
|
+
}
|
|
929
|
+
checkAllShardsCompleted();
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
|
|
921
933
|
eventLog.append("no_worker_commit_report", {
|
|
922
934
|
shard: shardName,
|
|
923
935
|
sessionId,
|
|
924
936
|
reason,
|
|
925
937
|
});
|
|
938
|
+
if (completedWorker) {
|
|
939
|
+
void closeNativeBridgeRegistration(
|
|
940
|
+
completedWorker,
|
|
941
|
+
shardName,
|
|
942
|
+
"failed",
|
|
943
|
+
);
|
|
944
|
+
}
|
|
926
945
|
failures.set(shardName, {
|
|
927
946
|
mode: FAILURE_MODES.F7_WORKER_DID_NOT_COMMIT,
|
|
928
947
|
reason,
|
|
@@ -970,6 +989,14 @@ export function createSwarmHypervisor(opts) {
|
|
|
970
989
|
}
|
|
971
990
|
}
|
|
972
991
|
|
|
992
|
+
if (completedWorker) {
|
|
993
|
+
void closeNativeBridgeRegistration(
|
|
994
|
+
completedWorker,
|
|
995
|
+
shardName,
|
|
996
|
+
"completed",
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
|
|
973
1000
|
completedShards.add(shardName);
|
|
974
1001
|
|
|
975
1002
|
if (isRedundant) {
|