fix: follow-up fixes for salvaged PRs
- Fix GatewayApp → GatewayRunner import in api_server.py (PR #4976) - Update launchd test assertions for new bootstrap/bootout/kickstart commands (PR #4892) - Add nonlocal message declaration in run_sync() to fix UnboundLocalError (pre-existing scoping bug)
This commit is contained in:
@@ -423,8 +423,8 @@ class APIServerAdapter(BasePlatformAdapter):
|
||||
|
||||
# Load fallback provider chain so the API server platform has the
|
||||
# same fallback behaviour as Telegram/Discord/Slack (fixes #4954).
|
||||
from gateway.run import GatewayApp
|
||||
fallback_model = GatewayApp._load_fallback_model()
|
||||
from gateway.run import GatewayRunner
|
||||
fallback_model = GatewayRunner._load_fallback_model()
|
||||
|
||||
agent = AIAgent(
|
||||
model=model,
|
||||
|
||||
@@ -6233,6 +6233,14 @@ class GatewayRunner:
|
||||
logger.debug("status_callback error (%s): %s", event_type, _e)
|
||||
|
||||
def run_sync():
|
||||
# The conditional re-assignment of `message` further below
|
||||
# (prepending model-switch notes) makes Python treat it as a
|
||||
# local variable in the entire function. `nonlocal` lets us
|
||||
# read *and* reassign the outer `_run_agent` parameter without
|
||||
# triggering an UnboundLocalError on the earlier read at
|
||||
# `_resolve_turn_agent_config(message, …)`.
|
||||
nonlocal message
|
||||
|
||||
# Pass session_key to process registry via env var so background
|
||||
# processes can be mapped back to this gateway session
|
||||
os.environ["HERMES_SESSION_KEY"] = session_key or ""
|
||||
|
||||
Reference in New Issue
Block a user