@moxt-ai/mobius 0.0.65 → 0.0.67

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.
@@ -1 +1 @@
1
- {"version":3,"file":"run-daemon.d.ts","sourceRoot":"","sources":["../src/run-daemon.ts"],"names":[],"mappings":"AA+GA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,KAAK,YAAY,EAA6C,MAAM,aAAa,CAAC;AAa3F,OAAO,EAA4B,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAssD5G,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,8BAA8B,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;CAC3G;AAujCD,wBAAsB,SAAS,CAC3B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAK,GAAE,WAA+B,EACtC,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
1
+ {"version":3,"file":"run-daemon.d.ts","sourceRoot":"","sources":["../src/run-daemon.ts"],"names":[],"mappings":"AAoHA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,KAAK,YAAY,EAA6C,MAAM,aAAa,CAAC;AAa3F,OAAO,EAA4B,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAqyD5G,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,8BAA8B,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;CAC3G;AA4kCD,wBAAsB,SAAS,CAC3B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,EACnB,KAAK,GAAE,WAA+B,EACtC,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
@@ -3,7 +3,7 @@ import { basename } from "node:path";
3
3
  import { styleText } from "node:util";
4
4
  import { AGENT_ACTIVITY_KIND, AGENT_CATALOG_REFRESH_FAILED_KIND, AGENT_CATALOG_REFRESH_KIND, AGENT_CATALOG_REFRESHED_KIND, AGENT_INSTALL_CANCEL_KIND, AGENT_INSTALL_CANCELLED_KIND, AGENT_INSTALL_COMPLETED_KIND, AGENT_INSTALL_FAILED_KIND, AGENT_INSTALL_PROGRESS_KIND, AGENT_INSTALL_REQUEST_KIND, AGENT_INSTALL_STARTED_KIND, AGENT_MESSAGE_DELTA_KIND, AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE, AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION, AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE, AGENT_SETTINGS_DISCOVER_KIND, AGENT_SETTINGS_DISCOVERED_KIND, AGENT_SETTINGS_DISCOVERY_FAILED_KIND, decodeServiceToDaemonMessage, decodeSessionEventEnvelope, decodeSessionLiveHistoryLoad, encodeDaemonToServiceMessage, encodeRecordedSessionEvent, FILE_FAILED_KIND, FILE_READ_KIND, NATIVE_SESSION_CANCEL_KIND, NATIVE_SESSION_REQUEST_KIND, NATIVE_SESSION_TURN_FORK_KIND, RUNTIME_DELIVERY_COMMITTED_KIND, RUNTIME_DELIVERY_KIND, RUNTIME_DELIVERY_RECEIVED_KIND, RUNTIME_HEARTBEAT_ACK_KIND, RUNTIME_LIVENESS_READY_KIND, SESSION_CANCEL_KIND, SESSION_COMPLETED_KIND, SESSION_CONFIGURE_KIND, SESSION_ELICITATION_RESPOND_KIND, SESSION_EVENT_ACK_KIND, SESSION_EVENT_DEFERRED_KIND, SESSION_EVENT_REJECTED_KIND, SESSION_FAILED_KIND, SESSION_LIVE_HISTORY_LOAD_KIND, SESSION_PERMISSION_RESPOND_KIND, SESSION_PREPARE_KIND, SESSION_PROMPT_KIND, SESSION_STARTED_KIND, SessionPromptDisposition, WORKSPACE_LIST_KIND, } from "@moxt-ai/mobius-protocol";
5
5
  import { fetch, WebSocket } from "undici";
6
- import { AcpExecutionError, AcpSessionManager } from "./acp/session-manager.js";
6
+ import { AcpConfigurationValueUnavailableError, AcpExecutionError, AcpSessionManager, } from "./acp/session-manager.js";
7
7
  import { SqliteAcpSessionStore } from "./acp/session-store.js";
8
8
  import { agentSettingsAdapterForAgent, applyAgentLaunchSettings } from "./agent-catalog/agent-settings-adapter.js";
9
9
  import { discoverLocalAgentInventory, supportedLocalAgentSpecifications, } from "./agent-catalog/discover-local-agents.js";
@@ -589,6 +589,19 @@ function operationErrorMessage(error) {
589
589
  }
590
590
  return "The local agent operation could not be completed";
591
591
  }
592
+ function agentSettingsFailureDetails(agentId, failure) {
593
+ const details = { agentId, code: operationErrorCode(failure) };
594
+ if (!(failure instanceof AcpConfigurationValueUnavailableError)) {
595
+ return details;
596
+ }
597
+ return {
598
+ ...details,
599
+ configId: failure.configId,
600
+ offeredValueCount: failure.offeredValueCount.toString(),
601
+ offeredValues: JSON.stringify(failure.offeredValues),
602
+ requestedValue: failure.requestedValue,
603
+ };
604
+ }
592
605
  function reportOperationFailure(socket, requestId, sessionId, error, runtimeTimings = []) {
593
606
  if (socket.readyState !== WebSocket.OPEN) {
594
607
  return;
@@ -621,6 +634,14 @@ async function resolveSessionDirectories(directories, bindingId, directoryId, ad
621
634
  }
622
635
  return new ResolvedSessionDirectories(cwd, additionalDirectories, additionalDirectoryEntries);
623
636
  }
637
+ function isUnavailableModel(cause, modelSettingId, requestedModel) {
638
+ return (cause instanceof AcpConfigurationValueUnavailableError &&
639
+ cause.configId === modelSettingId &&
640
+ cause.requestedValue === requestedModel);
641
+ }
642
+ function unsupportedModelIds(unsupportedModels) {
643
+ return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
644
+ }
624
645
  async function discoverAgentSettings(command, config, directories, sessions, signal) {
625
646
  const agent = config.catalog.find(command.agentId);
626
647
  const cwd = await directories.resolve(config.bindingId, "default", signal);
@@ -630,28 +651,50 @@ async function discoverAgentSettings(command, config, directories, sessions, sig
630
651
  cwd,
631
652
  signal,
632
653
  });
633
- const selectedSnapshot = command.model === undefined
634
- ? baseSnapshot
635
- : await sessions.inspectAgentSettings({
636
- additionalDirectories: [],
637
- agent,
638
- cwd,
639
- model: command.model,
640
- signal,
641
- });
654
+ const baseModel = modelOption(baseSnapshot.configOptions);
655
+ const unsupportedModels = [];
656
+ let selectedSnapshot = baseSnapshot;
657
+ if (command.model !== undefined) {
658
+ if (baseModel === undefined ||
659
+ baseModel.type !== "select" ||
660
+ !baseModel.values.some((value) => value.value === command.model)) {
661
+ unsupportedModels.push(new AcpConfigurationValueUnavailableError(baseModel?.id ?? "model", command.model, baseModel?.values.map((value) => value.value) ?? []));
662
+ }
663
+ else {
664
+ try {
665
+ selectedSnapshot = await sessions.inspectAgentSettings({
666
+ additionalDirectories: [],
667
+ agent,
668
+ cwd,
669
+ model: command.model,
670
+ signal,
671
+ });
672
+ }
673
+ catch (cause) {
674
+ signal.throwIfAborted();
675
+ if (!isUnavailableModel(cause, baseModel.id, command.model)) {
676
+ throw cause;
677
+ }
678
+ unsupportedModels.push(cause);
679
+ }
680
+ }
681
+ }
642
682
  const adapter = agentSettingsAdapterForAgent(agent.id);
643
- const baseSettings = settingsFromSnapshot(agent, baseSnapshot.configOptions);
644
- const settings = settingsFromSnapshot(agent, selectedSnapshot.configOptions);
645
- const modelEffort = await discoverModelEffort(command, agent, adapter.modelEffortResolution, baseSnapshot.configOptions, selectedSnapshot.configOptions, cwd, sessions, signal);
683
+ const modelEffort = await discoverModelEffort(command, agent, adapter.modelEffortResolution, baseSnapshot.configOptions, selectedSnapshot.configOptions, unsupportedModels, cwd, sessions, signal);
684
+ const baseSettings = withoutUnsupportedModels(settingsFromSnapshot(agent, baseSnapshot.configOptions), baseModel?.id ?? "", modelEffort.unsupportedModelIds);
685
+ const settings = withoutUnsupportedModels(settingsFromSnapshot(agent, selectedSnapshot.configOptions), baseModel?.id ?? "", modelEffort.unsupportedModelIds);
646
686
  return {
647
- agentId: command.agentId,
648
- agentName: selectedSnapshot.agentName,
649
- agentVersion: selectedSnapshot.agentVersion,
650
- kind: AGENT_SETTINGS_DISCOVERED_KIND,
651
- modelEffort,
652
- requestId: command.requestId,
653
- settings,
654
- settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort),
687
+ event: {
688
+ agentId: command.agentId,
689
+ agentName: selectedSnapshot.agentName,
690
+ agentVersion: selectedSnapshot.agentVersion,
691
+ kind: AGENT_SETTINGS_DISCOVERED_KIND,
692
+ modelEffort,
693
+ requestId: command.requestId,
694
+ settings,
695
+ settingsRevision: settingsRevision(agent, baseSnapshot.agentVersion, baseSettings, modelEffort),
696
+ },
697
+ unsupportedModels,
655
698
  };
656
699
  }
657
700
  function settingFromOption(option) {
@@ -683,6 +726,22 @@ function settingsFromSnapshot(agent, configOptions) {
683
726
  }
684
727
  return settings;
685
728
  }
729
+ function withoutUnsupportedModels(settings, modelSettingId, unsupportedModelIds) {
730
+ if (modelSettingId.length === 0 || unsupportedModelIds.length === 0) {
731
+ return settings;
732
+ }
733
+ const unsupported = new Set(unsupportedModelIds);
734
+ return settings.map((setting) => {
735
+ if (setting.id !== modelSettingId || setting.type !== "select") {
736
+ return setting;
737
+ }
738
+ return {
739
+ ...setting,
740
+ defaultValue: unsupported.has(setting.defaultValue) ? "" : setting.defaultValue,
741
+ values: setting.values.filter((value) => !unsupported.has(value.value)),
742
+ };
743
+ });
744
+ }
686
745
  function modelOption(options) {
687
746
  return options.find((option) => option.id === "model" || option.category === "model");
688
747
  }
@@ -694,17 +753,19 @@ function unavailableModelEffort() {
694
753
  effortSettingId: "",
695
754
  modelSettingId: "",
696
755
  resolution: AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE,
756
+ unsupportedModelIds: [],
697
757
  valuesByModel: {},
698
758
  };
699
759
  }
700
- async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, cwd, sessions, signal) {
760
+ async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
701
761
  const model = modelOption(initialOptions);
762
+ const unsupportedModels = initiallyUnsupportedModels;
702
763
  if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE &&
703
764
  resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
704
- return unavailableModelEffort();
765
+ return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
705
766
  }
706
767
  if (model === undefined || model.type !== "select" || model.values.length === 0) {
707
- return unavailableModelEffort();
768
+ return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
708
769
  }
709
770
  const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
710
771
  additionalDirectories: [],
@@ -717,29 +778,46 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
717
778
  if (resolution === "complete") {
718
779
  const effort = effortOption(initialOptions);
719
780
  if (effort === undefined || effort.type !== "select" || effort.values.length < 2) {
720
- return unavailableModelEffort();
781
+ return {
782
+ ...unavailableModelEffort(),
783
+ unsupportedModelIds: unsupportedModelIds(unsupportedModels),
784
+ };
721
785
  }
722
786
  for (const value of model.values) {
723
- const selectedEffort = effortOption(await inspectModel(value.value));
724
- valuesByModel[value.value] = selectedEffort?.type === "select" ? selectedEffort.values : [];
787
+ if (unsupportedModels.some((diagnostic) => diagnostic.requestedValue === value.value)) {
788
+ continue;
789
+ }
790
+ try {
791
+ const selectedEffort = effortOption(await inspectModel(value.value));
792
+ valuesByModel[value.value] = selectedEffort?.type === "select" ? selectedEffort.values : [];
793
+ }
794
+ catch (cause) {
795
+ signal.throwIfAborted();
796
+ if (!isUnavailableModel(cause, model.id, value.value)) {
797
+ throw cause;
798
+ }
799
+ unsupportedModels.push(cause);
800
+ }
725
801
  }
726
802
  return {
727
803
  effortSettingId: effort.id,
728
804
  modelSettingId: model.id,
729
805
  resolution: "complete",
806
+ unsupportedModelIds: unsupportedModelIds(unsupportedModels),
730
807
  valuesByModel,
731
808
  };
732
809
  }
733
810
  if (command.model !== undefined) {
734
- if (!model.values.some((value) => value.value === command.model)) {
735
- throw new AcpExecutionError("The selected Agent model is unavailable", {}, "invalid_session_configuration");
736
- }
811
+ const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command.model);
737
812
  const selectedEffort = effortOption(selectedOptions);
738
- valuesByModel[command.model] = selectedEffort?.type === "select" ? selectedEffort.values : [];
813
+ if (!modelUnsupported) {
814
+ valuesByModel[command.model] = selectedEffort?.type === "select" ? selectedEffort.values : [];
815
+ }
739
816
  return {
740
817
  effortSettingId: selectedEffort?.id ?? "",
741
818
  modelSettingId: model.id,
742
819
  resolution: "on_model_selection",
820
+ unsupportedModelIds: unsupportedModelIds(unsupportedModels),
743
821
  valuesByModel,
744
822
  };
745
823
  }
@@ -748,16 +826,28 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
748
826
  // too, or a session that never switches models can never offer an effort.
749
827
  const defaultModel = model.type === "select" ? model.currentValue : "";
750
828
  const reportedEffort = effortOption(selectedOptions);
751
- const selectedEffort = defaultModel.length > 0 && reportedEffort === undefined
752
- ? effortOption(await inspectModel(defaultModel))
753
- : reportedEffort;
754
- if (defaultModel.length > 0) {
829
+ let selectedEffort = reportedEffort;
830
+ if (defaultModel.length > 0 && reportedEffort === undefined) {
831
+ try {
832
+ selectedEffort = effortOption(await inspectModel(defaultModel));
833
+ }
834
+ catch (cause) {
835
+ signal.throwIfAborted();
836
+ if (!isUnavailableModel(cause, model.id, defaultModel)) {
837
+ throw cause;
838
+ }
839
+ unsupportedModels.push(cause);
840
+ }
841
+ }
842
+ if (defaultModel.length > 0 &&
843
+ !unsupportedModels.some((diagnostic) => diagnostic.requestedValue === defaultModel)) {
755
844
  valuesByModel[defaultModel] = selectedEffort?.type === "select" ? selectedEffort.values : [];
756
845
  }
757
846
  return {
758
847
  effortSettingId: selectedEffort?.id ?? "",
759
848
  modelSettingId: model.id,
760
849
  resolution: "on_model_selection",
850
+ unsupportedModelIds: unsupportedModelIds(unsupportedModels),
761
851
  valuesByModel,
762
852
  };
763
853
  }
@@ -771,6 +861,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
771
861
  effortSettingId: "",
772
862
  modelSettingId: modelEffort.modelSettingId,
773
863
  resolution: modelEffort.resolution,
864
+ unsupportedModelIds: modelEffort.unsupportedModelIds,
774
865
  valuesByModel: {},
775
866
  };
776
867
  return createHash("sha256")
@@ -868,9 +959,14 @@ async function executeSessionPrepare(publisher, socket, command, config, directo
868
959
  sessionId: command.sessionId,
869
960
  runtimeTimings: metrics.snapshot(),
870
961
  };
871
- metrics.measureSync("readiness-commit", () => {
872
- publisher.recordRuntime(command.sessionId, event);
873
- });
962
+ // An inspection-only preparation has no Session on the Relay, so this readiness is a reply
963
+ // rather than a record: committing it would be rejected as an unknown Session and quarantine
964
+ // an event that can never be replayed. The direct send below still delivers it.
965
+ if (command.transient !== true) {
966
+ metrics.measureSync("readiness-commit", () => {
967
+ publisher.recordRuntime(command.sessionId, event);
968
+ });
969
+ }
874
970
  return event;
875
971
  });
876
972
  send(socket, {
@@ -1000,7 +1096,11 @@ async function executePrompt(outbox, publisher, command, config, directories, au
1000
1096
  signal,
1001
1097
  });
1002
1098
  if (command.disposition === SessionPromptDisposition.Steer) {
1003
- assertCompleteSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
1099
+ // Steering cannot reconfigure a running Agent, so the Turn snapshot
1100
+ // only has to agree with the settings this live Session exposes. The
1101
+ // snapshot comes from Agent settings discovery, so it may name options
1102
+ // that the running Session does not expose at all.
1103
+ assertAppliedSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
1004
1104
  }
1005
1105
  else {
1006
1106
  await applyCompleteSessionConfiguration(sessions, audit, prepared.configOptions, sessionConfigurations ?? [], executionAgent, resolved.cwd, resolved.additionalDirectories, command.commandId, command.sessionId, signal);
@@ -1119,24 +1219,6 @@ function validateSessionConfigurationSelection(option, selection) {
1119
1219
  throw invalidSessionConfiguration(`The Agent setting ${selection.configId} has an unavailable value`);
1120
1220
  }
1121
1221
  }
1122
- function assertSessionConfigurationSchema(options, selections) {
1123
- if (options.length !== selections.length) {
1124
- throw invalidSessionConfiguration("The Turn configuration does not match the Agent settings schema");
1125
- }
1126
- const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
1127
- if (selectionsById.size !== selections.length) {
1128
- throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
1129
- }
1130
- for (const option of options) {
1131
- const selection = selectionsById.get(option.id);
1132
- if (selection === undefined ||
1133
- selection.valueType !== option.type ||
1134
- (option.type === "boolean" && selection.value.length > 0) ||
1135
- (option.type === "select" && selection.booleanValue)) {
1136
- throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
1137
- }
1138
- }
1139
- }
1140
1222
  function sessionConfigurationSelectionIsAvailable(option, selection) {
1141
1223
  if (option.type !== selection.valueType) {
1142
1224
  return false;
@@ -1165,16 +1247,6 @@ function sessionConfigurationPriority(selection, options) {
1165
1247
  }
1166
1248
  return 3;
1167
1249
  }
1168
- function assertCompleteSessionConfiguration(options, selections) {
1169
- assertSessionConfigurationSchema(options, selections);
1170
- const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
1171
- for (const option of options) {
1172
- const selection = selectionsById.get(option.id);
1173
- if (selection === undefined || !sessionConfigurationMatches(option, selection)) {
1174
- throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
1175
- }
1176
- }
1177
- }
1178
1250
  function assertAppliedSessionConfiguration(options, selections) {
1179
1251
  const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
1180
1252
  for (const option of options) {
@@ -1709,14 +1781,27 @@ async function runRelayConnection(config, directories, audit, sessions, installa
1709
1781
  const completion = (async () => {
1710
1782
  try {
1711
1783
  const result = await discoverAgentSettings(command, config, directories, sessions, operationSignal);
1784
+ for (const diagnostic of result.unsupportedModels) {
1785
+ const details = agentSettingsFailureDetails(command.agentId, diagnostic);
1786
+ audit.record({
1787
+ commandId: command.requestId,
1788
+ details,
1789
+ event: "agent_settings_model_unsupported",
1790
+ sessionId: `agent-settings:${command.agentId}`,
1791
+ });
1792
+ process.stderr.write(`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command.requestId, ...details })}\n`);
1793
+ }
1712
1794
  audit.record({
1713
1795
  commandId: command.requestId,
1714
- details: { agentId: command.agentId },
1796
+ details: {
1797
+ agentId: command.agentId,
1798
+ unsupportedModelCount: result.unsupportedModels.length.toString(),
1799
+ },
1715
1800
  event: "agent_settings_discovered",
1716
1801
  sessionId: `agent-settings:${command.agentId}`,
1717
1802
  });
1718
1803
  if (socket.readyState === WebSocket.OPEN) {
1719
- send(socket, result);
1804
+ send(socket, result.event);
1720
1805
  }
1721
1806
  }
1722
1807
  catch (error) {
@@ -1724,12 +1809,16 @@ async function runRelayConnection(config, directories, audit, sessions, installa
1724
1809
  ? (controller.signal.reason ??
1725
1810
  new AcpExecutionError("Agent settings discovery cancelled", {}, "agent_settings_discovery_cancelled"))
1726
1811
  : error;
1812
+ const details = agentSettingsFailureDetails(command.agentId, failure);
1727
1813
  audit.record({
1728
1814
  commandId: command.requestId,
1729
- details: { agentId: command.agentId, code: operationErrorCode(failure) },
1815
+ details,
1730
1816
  event: "agent_settings_discovery_failed",
1731
1817
  sessionId: `agent-settings:${command.agentId}`,
1732
1818
  });
1819
+ if (failure instanceof AcpConfigurationValueUnavailableError) {
1820
+ process.stderr.write(`Mobius daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command.requestId, ...details })}\n`);
1821
+ }
1733
1822
  if (socket.readyState === WebSocket.OPEN) {
1734
1823
  send(socket, {
1735
1824
  code: operationErrorCode(failure),