opencode-immune 1.0.80 → 1.0.81
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/dist/plugin/server.js +42 -2
- package/package.json +1 -1
package/dist/plugin/server.js
CHANGED
|
@@ -3777,7 +3777,7 @@ import { fileURLToPath } from "url";
|
|
|
3777
3777
|
import { createHash } from "crypto";
|
|
3778
3778
|
import { tmpdir } from "os";
|
|
3779
3779
|
import { execFile } from "child_process";
|
|
3780
|
-
var PLUGIN_VERSION = "1.0.
|
|
3780
|
+
var PLUGIN_VERSION = "1.0.81";
|
|
3781
3781
|
var PLUGIN_PACKAGE_NAME = "opencode-immune";
|
|
3782
3782
|
var PLUGIN_DIRNAME = dirname(fileURLToPath(import.meta.url));
|
|
3783
3783
|
function getServerAuthHeaders() {
|
|
@@ -3897,6 +3897,7 @@ var RETRY_PROMPT_DELIVERY_ATTEMPTS = 3;
|
|
|
3897
3897
|
var CHILD_FALLBACK_REQUEST_TTL_MS = 10 * 60 * 1e3;
|
|
3898
3898
|
var AUTO_CYCLE_LOCK_TTL_MS = 30 * 60 * 1e3;
|
|
3899
3899
|
var FALLBACK_AUTO_CYCLE_DELAY_MS = 6e4;
|
|
3900
|
+
var ROOT_RETRY_CHILD_ACTIVITY_SUPPRESSION_MS = 2 * 6e4;
|
|
3900
3901
|
var MODEL_NAME_CAPABILITY_SCORE = {
|
|
3901
3902
|
"claude-opus-4-7": 100,
|
|
3902
3903
|
"gpt-5.5": 100,
|
|
@@ -3923,6 +3924,19 @@ function hasRecentManagedChildSessionForRoot(state, rootSessionID, sinceMs) {
|
|
|
3923
3924
|
}
|
|
3924
3925
|
return false;
|
|
3925
3926
|
}
|
|
3927
|
+
function hasPendingChildFallbackRequestForRoot(state, rootSessionID, now = Date.now()) {
|
|
3928
|
+
for (const request of state.childFallbackRequests.values()) {
|
|
3929
|
+
if (request.rootSessionID === rootSessionID && now - request.createdAt <= CHILD_FALLBACK_REQUEST_TTL_MS) return true;
|
|
3930
|
+
}
|
|
3931
|
+
return false;
|
|
3932
|
+
}
|
|
3933
|
+
function shouldSuppressRootRetryForChildActivity(state, rootSessionID) {
|
|
3934
|
+
return hasPendingChildFallbackRequestForRoot(state, rootSessionID) || hasRecentManagedChildSessionForRoot(
|
|
3935
|
+
state,
|
|
3936
|
+
rootSessionID,
|
|
3937
|
+
ROOT_RETRY_CHILD_ACTIVITY_SUPPRESSION_MS
|
|
3938
|
+
);
|
|
3939
|
+
}
|
|
3926
3940
|
async function createManagedUltraworkSession(state, title) {
|
|
3927
3941
|
const result = await state.client.session.create({
|
|
3928
3942
|
directory: state.input.directory,
|
|
@@ -4101,8 +4115,15 @@ async function isUltraworkMarkerActive(state) {
|
|
|
4101
4115
|
}
|
|
4102
4116
|
async function addManagedUltraworkSession(state, sessionID, timestamp = Date.now()) {
|
|
4103
4117
|
const existing = state.managedUltraworkSessions.get(sessionID);
|
|
4118
|
+
if (existing?.kind === "child") {
|
|
4119
|
+
state.managedUltraworkSessions.set(sessionID, {
|
|
4120
|
+
...existing,
|
|
4121
|
+
updatedAt: timestamp
|
|
4122
|
+
});
|
|
4123
|
+
return;
|
|
4124
|
+
}
|
|
4104
4125
|
const nextRecord = {
|
|
4105
|
-
kind:
|
|
4126
|
+
kind: "root",
|
|
4106
4127
|
agent: ULTRAWORK_AGENT,
|
|
4107
4128
|
rootSessionID: existing?.rootSessionID ?? sessionID,
|
|
4108
4129
|
parentSessionID: existing?.parentSessionID,
|
|
@@ -5641,6 +5662,14 @@ function createEventHandler(state) {
|
|
|
5641
5662
|
"aborted message recovery"
|
|
5642
5663
|
);
|
|
5643
5664
|
if (managedSession?.kind === "root") {
|
|
5665
|
+
if (shouldSuppressRootRetryForChildActivity(state, sessionID)) {
|
|
5666
|
+
await writeDiagnosticLog(state, "session-retry:root-suppressed-child-active", {
|
|
5667
|
+
sessionID,
|
|
5668
|
+
messageID,
|
|
5669
|
+
eventType
|
|
5670
|
+
});
|
|
5671
|
+
return;
|
|
5672
|
+
}
|
|
5644
5673
|
state.abortedMessageRetries.add(retryKey);
|
|
5645
5674
|
await writeDiagnosticLog(state, "session-retry:aborted-message-observed", {
|
|
5646
5675
|
sessionID,
|
|
@@ -5734,6 +5763,17 @@ function createEventHandler(state) {
|
|
|
5734
5763
|
);
|
|
5735
5764
|
return;
|
|
5736
5765
|
}
|
|
5766
|
+
if (isRoot && shouldSuppressRootRetryForChildActivity(state, sessionID)) {
|
|
5767
|
+
await writeDiagnosticLog(state, "session-retry:root-suppressed-child-active", {
|
|
5768
|
+
sessionID,
|
|
5769
|
+
eventType,
|
|
5770
|
+
errorType: getRetryableErrorType(error)
|
|
5771
|
+
});
|
|
5772
|
+
pluginLog.info(
|
|
5773
|
+
`[opencode-immune] Suppressed root retry for ${sessionID}: child session activity owns this failure.`
|
|
5774
|
+
);
|
|
5775
|
+
return;
|
|
5776
|
+
}
|
|
5737
5777
|
const count = state.sessionErrorRetryCount.get(sessionID) ?? 0;
|
|
5738
5778
|
if (count < MAX_RETRIES) {
|
|
5739
5779
|
const delay = Math.min(BASE_DELAY_MS * Math.pow(2, count), MAX_DELAY_MS);
|