fix(compaction): preserve native capability across runtime switches
Stage destination native-compaction capabilities until the complete runtime and context setup succeeds, and restore them with primary and fallback runtimes. Keep native compaction default-deny across live switches and session reconstruction.\n\nVerification: uv run --with pytest --with pyyaml python -m pytest tests/run_agent/test_switch_model_context.py tests/run_agent/test_native_compaction.py tests/run_agent/test_native_compaction_switch_capabilities.py tests/run_agent/test_switch_model_rollback.py tests/run_agent/test_fallback_reasoning_override.py tests/run_agent/test_primary_runtime_restore.py tests/run_agent/test_provider_fallback.py -q -o 'addopts='; uv run --with ruff ruff check <touched files>; git diff --check
This commit is contained in:
@@ -10306,6 +10306,7 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
|
||||
api_key=_reset_result.api_key,
|
||||
base_url=_reset_result.base_url,
|
||||
api_mode=_reset_result.api_mode,
|
||||
capabilities=_reset_result.runtime_capabilities,
|
||||
)
|
||||
self.model = _reset_result.new_model
|
||||
self.provider = _reset_result.target_provider
|
||||
@@ -11480,6 +11481,7 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
|
||||
api_key=snapshot.get("api_key", ""),
|
||||
base_url=snapshot.get("base_url", ""),
|
||||
api_mode=snapshot.get("api_mode", ""),
|
||||
capabilities=snapshot.get("capabilities"),
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.warning("CLI one-turn model restore failed: %s", exc)
|
||||
@@ -11624,6 +11626,7 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
|
||||
api_key=result.api_key,
|
||||
base_url=result.base_url,
|
||||
api_mode=result.api_mode,
|
||||
capabilities=result.runtime_capabilities,
|
||||
)
|
||||
except Exception as exc:
|
||||
# The agent rolled itself back to the old working model/client.
|
||||
@@ -12014,6 +12017,7 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
|
||||
api_key=result.api_key,
|
||||
base_url=result.base_url,
|
||||
api_mode=result.api_mode,
|
||||
capabilities=result.runtime_capabilities,
|
||||
)
|
||||
except Exception as exc:
|
||||
# Agent rolled itself back; roll the CLI back too and abort so a
|
||||
|
||||
Reference in New Issue
Block a user