sortie-dogs 0.12.21 → 0.12.22

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.
@@ -3,5 +3,5 @@
3
3
  * installed project marker without importing every asset body.
4
4
  */
5
5
  export declare const RUNTIME_ASSET_VERSION = "0.3.89-completion-proof-v1";
6
- export declare const V010_RUNTIME_ASSET_VERSION = "0.12.21-validation-recovery-v1";
6
+ export declare const V010_RUNTIME_ASSET_VERSION = "0.12.22-mission-replacement-v1";
7
7
  export type RuntimeAssetVersion = typeof RUNTIME_ASSET_VERSION | typeof V010_RUNTIME_ASSET_VERSION;
@@ -3,4 +3,4 @@
3
3
  * installed project marker without importing every asset body.
4
4
  */
5
5
  export const RUNTIME_ASSET_VERSION = "0.3.89-completion-proof-v1";
6
- export const V010_RUNTIME_ASSET_VERSION = "0.12.21-validation-recovery-v1";
6
+ export const V010_RUNTIME_ASSET_VERSION = "0.12.22-mission-replacement-v1";
@@ -695,8 +695,15 @@ export class OperatorRuntime {
695
695
  }
696
696
  async prepareOnce(root, raw, scopeApprovalTurnID, mission) {
697
697
  const previous = await this.read(root);
698
+ const superseding = mission?.supersededRunID !== undefined && previous?.runID === mission.supersededRunID &&
699
+ previous.phase === "cancelled";
700
+ // A later user-requested mission is not a repair of the old failed acceptance. Preserve
701
+ // the old run and its spend, but do not rewrite the new requirements to its remediation plan.
702
+ const replacingFailedAcceptance = superseding && mission?.replaceRequirements === true &&
703
+ previous.decision === ACCEPTANCE_REMEDIATION_DECISION;
698
704
  let immutableReplacement = previous?.phase === "cancelled" &&
699
- [ACCEPTANCE_REMEDIATION_DECISION, REVIEW_REMEDIATION_DECISION].includes(previous.decision ?? "") && record(raw)
705
+ [ACCEPTANCE_REMEDIATION_DECISION, REVIEW_REMEDIATION_DECISION].includes(previous.decision ?? "") &&
706
+ !replacingFailedAcceptance && record(raw)
700
707
  ? { ...raw, acceptance: [...previous.acceptance], source_refs: [...previous.sourceRefs] }
701
708
  : raw;
702
709
  if (immutableReplacement !== raw && previous && record(immutableReplacement) && record(immutableReplacement.goal_declaration)) {
@@ -731,15 +738,13 @@ export class OperatorRuntime {
731
738
  if (mission?.supersededRunID !== undefined && previous?.supersededRunID === mission.supersededRunID &&
732
739
  previous.planHash === validatedPlanHash && previous.phase !== "cancelled")
733
740
  return previous;
734
- const superseding = mission?.supersededRunID !== undefined && previous?.runID === mission.supersededRunID &&
735
- previous.phase === "cancelled";
736
741
  if (mission?.supersededRunID !== undefined && !superseding)
737
742
  throw new Error("mission-superseded-run-mismatch");
738
743
  const terminalChildren = mission?.terminalChildren ?? [];
739
744
  const retainAcceptance = previous !== undefined && cancelledMissionRetainsAcceptance(previous);
740
745
  const predecessorChildren = previous?.units.flatMap(unit => unit.childSessionID !== null
741
746
  ? [unit.childSessionID] : []) ?? [];
742
- if (superseding && previous && (!["explicit-cancellation", "agent-changed"].includes(previous.decision ?? "") || previous.gitLifecycle !== null ||
747
+ if (superseding && previous && (!replacingFailedAcceptance && !["explicit-cancellation", "agent-changed"].includes(previous.decision ?? "") || previous.gitLifecycle !== null ||
743
748
  previous.repairResidualPaths.length > 0 || previous.contractRepair !== null ||
744
749
  terminalChildren.length !== predecessorChildren.length || new Set(terminalChildren).size !== terminalChildren.length ||
745
750
  predecessorChildren.some(id => !terminalChildren.includes(id)) || previous.units.some(unit => !(retainAcceptance ? ["pending", "cancelled", "succeeded", "failed"] : ["pending", "cancelled"]).includes(unit.status) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sortie-dogs",
3
- "version": "0.12.21",
3
+ "version": "0.12.22",
4
4
  "description": "Bounded agent harness and validated orchestration loop plugin for OpenCode",
5
5
  "keywords": [
6
6
  "opencode",