refactor(hermes_cli): middleware/mcp_picker/mcp_security/mcp_startup/memory_oauth — hoist _DownstreamExecutionError, compact layout and docstrings
This commit is contained in:
@@ -23,8 +23,8 @@ def _resolve_flow(provider: str):
|
||||
|
||||
@contextmanager
|
||||
def _scope_to_profile(profile: Optional[str]):
|
||||
"""Scope config resolution to ``profile`` so the flow's eager path resolve
|
||||
targets that profile's honcho.json. None/""/"current" leaves it untouched."""
|
||||
"""Scope config resolution to ``profile`` so the flow's eager path resolve targets that profile's
|
||||
honcho.json. None/""/"current" leaves it untouched."""
|
||||
requested = (profile or "").strip()
|
||||
if not requested or requested.lower() == "current":
|
||||
yield
|
||||
@@ -49,12 +49,10 @@ def _scope_to_profile(profile: Optional[str]):
|
||||
|
||||
@router.post("/{provider}/oauth/start")
|
||||
async def start_memory_oauth(provider: str, profile: Optional[str] = None):
|
||||
"""Begin a provider's zero-CLI OAuth flow — opens the browser and captures
|
||||
the grant via the loopback listener. Returns immediately; poll status."""
|
||||
"""Begin a provider's zero-CLI OAuth flow (browser + loopback listener). Returns immediately; poll status."""
|
||||
flow = _resolve_flow(provider)
|
||||
try:
|
||||
# The flow resolves its config path eagerly inside this scope; the worker
|
||||
# thread it spawns outlives the request and the override.
|
||||
# The flow resolves its config path eagerly inside this scope; its worker thread outlives it.
|
||||
with _scope_to_profile(profile):
|
||||
return flow.start_loopback_flow_background()
|
||||
except HTTPException:
|
||||
|
||||
Reference in New Issue
Block a user