chore(compose): add shared json-file logging config and component labels
All checks were successful
CVE Scan & Docker Build / security-scan (push) Successful in 49s
CVE Scan & Docker Build / build-and-push (push) Successful in 2m19s

Introduce x-logging anchor with json-file driver, size/file caps, and
container name tagging so Alloy on puck can reliably tail every service
through the Docker socket. Apply to all services and inject
MNEMOSYNE_COMPONENT env vars (init/app/mcp/worker) for consistent log
attribution both in Loki and via `docker logs`.

Also update mnemosyne_integration.md to reflect the shift from per-turn
JWTs to long-lived team JWTs for workspace-scoped MCP access.
This commit is contained in:
2026-05-11 14:21:40 -04:00
parent 551c641e90
commit d57294db67
3 changed files with 234 additions and 8 deletions

View File

@@ -32,23 +32,32 @@ from .auth import (
)
# ``Context.get_state`` is a synchronous method in FastMCP — it returns the
# stored value (``Any``) or ``None`` if the key is absent. Awaiting the
# returned value raises ``TypeError: object NoneType can't be used in 'await'
# expression`` whenever the value is ``None`` (and is semantically wrong even
# when it isn't). These helpers stay ``async def`` so call sites (and their
# ``await`` usage) don't have to change, but they call ``get_state``
# synchronously.
async def get_mcp_user(ctx: Context | None):
if ctx is None:
return None
return await ctx.get_state(STATE_KEY_USER)
return ctx.get_state(STATE_KEY_USER)
async def get_mcp_token(ctx: Context | None):
if ctx is None:
return None
return await ctx.get_state(STATE_KEY_TOKEN)
return ctx.get_state(STATE_KEY_TOKEN)
async def get_mcp_claims(ctx: Context | None) -> dict | None:
"""Return the JWT claims dict for this request, or None for opaque-token callers."""
if ctx is None:
return None
return await ctx.get_state(STATE_KEY_CLAIMS)
return ctx.get_state(STATE_KEY_CLAIMS)
async def get_mcp_resolved_libraries(ctx: Context | None) -> list[str] | None:
@@ -68,4 +77,4 @@ async def get_mcp_resolved_libraries(ctx: Context | None) -> list[str] | None:
"""
if ctx is None:
return None
return await ctx.get_state(STATE_KEY_RESOLVED_LIBRARIES)
return ctx.get_state(STATE_KEY_RESOLVED_LIBRARIES)