@agentsignalnet/claude-plugin 0.2.93 → 0.2.94
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.
package/package.json
CHANGED
package/scripts/inbox-daemon.mjs
CHANGED
|
@@ -1012,18 +1012,24 @@ function standDownEarly() {
|
|
|
1012
1012
|
*
|
|
1013
1013
|
* Only among rivals sharing this mtime. A genuinely newer build has already
|
|
1014
1014
|
* been dealt with above and must not be stood down to on a pid comparison.
|
|
1015
|
+
*
|
|
1016
|
+
* Called at startup AND on every tick, because one look is not enough: see the
|
|
1017
|
+
* note at the interval below for the interleaving a single look loses.
|
|
1015
1018
|
*/
|
|
1016
|
-
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
+
function yieldToLowerPid(exit) {
|
|
1020
|
+
const twins = livingWatchers(lockRoot).filter((rival) => rival.mtime === me.mtime);
|
|
1021
|
+
const usurper = twins.find((rival) => rival.pid < process.pid);
|
|
1022
|
+
if (!usurper) return false;
|
|
1019
1023
|
say(
|
|
1020
1024
|
`pid ${usurper.pid} is watching the same build; standing down ` +
|
|
1021
1025
|
'(the startup lock did not serialise this, which is a separate bug)',
|
|
1022
1026
|
);
|
|
1023
|
-
|
|
1027
|
+
exit();
|
|
1024
1028
|
process.exit(0);
|
|
1025
1029
|
}
|
|
1026
1030
|
|
|
1031
|
+
yieldToLowerPid(standDownEarly);
|
|
1032
|
+
|
|
1027
1033
|
// Best effort, and correctness does not depend on it -- a start that finds
|
|
1028
1034
|
// this entry checks the pid before believing it. It is here so an ordinary
|
|
1029
1035
|
// stop leaves nothing behind, rather than leaving the next start to reason
|
|
@@ -1064,5 +1070,14 @@ for (const identity of identities()) {
|
|
|
1064
1070
|
|
|
1065
1071
|
await tick();
|
|
1066
1072
|
setInterval(() => {
|
|
1073
|
+
// Reconcile on every tick, not only at startup. Registering and looking are
|
|
1074
|
+
// two steps, so a one-shot check at startup loses a race it is supposed to
|
|
1075
|
+
// settle: if the higher pid registers first and looks before the lower one
|
|
1076
|
+
// has registered, it sees an empty registry and stays -- and the lower pid,
|
|
1077
|
+
// looking afterwards, is the one entitled to stay. Both keep watching, which
|
|
1078
|
+
// is the exact duplicate this check exists to prevent. Looking again each
|
|
1079
|
+
// tick converges whatever the order was, because the late registration is
|
|
1080
|
+
// visible by the next one.
|
|
1081
|
+
if (yieldToLowerPid(standDown)) return;
|
|
1067
1082
|
tick().catch((error) => complain(`Unexpected: ${error.stack ?? error.message}`));
|
|
1068
1083
|
}, intervalMs);
|