feat(maf): add secure roundtable workflow runtime
This commit is contained in:
1 parent
e690475e6e
commit
bd4131b4e2
52 files changed
+10315
-96
No files matched your search
@@ -328,13 +328,41 @@ async def langgraph_runtime(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
maf_admin_diag = (
|
||||
bool(getattr(maf_cfg, "admin_diagnostic_access", True)) if maf_cfg is not None else True
|
||||
)
|
||||
# P0-4: when MAF is switched on, its full safety stack must be in
|
||||
# place (write_guard mounted + provider complete + bridge resolvable
|
||||
# + MAF_ACTION_SECRET_KEY set). If any prerequisite is missing the
|
||||
# feature is forced OFF (clearly logged) — never "MAF on, approval
|
||||
# guard not mounted". Reads stay open for admin history review.
|
||||
if maf_enabled:
|
||||
from app.maf_roundtable.service import (
|
||||
MafConfigurationError,
|
||||
validate_maf_prerequisites,
|
||||
)
|
||||
|
||||
try:
|
||||
validate_maf_prerequisites()
|
||||
except MafConfigurationError as cfg_exc:
|
||||
logger.error(
|
||||
"[maf-roundtable] enabled but prerequisites unmet — "
|
||||
"forcing the feature OFF: %s",
|
||||
cfg_exc,
|
||||
)
|
||||
maf_enabled = False
|
||||
if app.state.maf_roundtable_store is not None:
|
||||
app.state.maf_roundtable_service = MafRoundtableService(
|
||||
app.state.maf_roundtable_store,
|
||||
enabled=maf_enabled,
|
||||
admin_diagnostic_access=maf_admin_diag,
|
||||
config=maf_cfg,
|
||||
agent_store=getattr(app.state, "agent_store", None),
|
||||
app_config=config,
|
||||
)
|
||||
# Wire the WriteGuard bridge so the harness middleware can reach
|
||||
# the service when intercepting external-write tool calls.
|
||||
if app.state.maf_roundtable_service is not None:
|
||||
from app.maf_roundtable.write_guard_bridge import register_write_guard_service
|
||||
|
||||
register_write_guard_service(app.state.maf_roundtable_service)
|
||||
else:
|
||||
app.state.maf_roundtable_service = None
|
||||
except Exception: # noqa: BLE001 — experimental feature must never abort startup
|
||||
|
||||
Reference in new issue
Block a user