Skip to content

No community-scoped env tier: any record can spawn into any community carrying another community's credentials #4099

Description

@andydoucet

Is your feature request related to a problem? Please describe.

Under agents-everywhere (#2122), effective_agent_relay_url() deliberately ignores a record's relay_url pin: any managed-agent record can be spawned into any community, and the pair is identified by the workspace relay. That design leaves no supported place to put community-scoped configuration — most importantly credentials:

We hit this concretely running two communities from one desktop, each with its own memory-service account (same shape as #2717's motivating CLAUDE_CONFIG_DIR-per-community case): a restart cycle spawned records into the other community's relay carrying the other community's API key — a silent cross-tenant credential leak, with data written into the wrong account's store. On 0.5.3 the only reliable workaround we found was wrapping the harness binaries in a shim that re-derives the key from BUZZ_RELAY_URL at exec time — which works precisely because the effective relay in the spawned process env is the only community signal that is always truthful.

Describe the solution you'd like

A relay-keyed env tier in the global agent config — location-scoped where the existing tiers are identity-scoped, matching the agents-everywhere model instead of fighting it:

// global-agent-config.json
{
  "env_vars": { "SHARED_KEY": "..." },
  "community_env_vars": {
    "wss://work.example.com":     { "MEMORY_API_KEY": "work-key",     "CLAUDE_CONFIG_DIR": "/home/u/.claude-work" },
    "wss://personal.example.com": { "MEMORY_API_KEY": "personal-key", "CLAUDE_CONFIG_DIR": "/home/u/.claude-personal" }
  }
}

Injected at the single descriptor resolver keyed by the effective spawn relay, layered global < community < persona < per-agent, with the same reserved/derived/malformed-key rules as every other tier. Because it keys off the effective relay rather than the record, it stays correct no matter which record the UI or restore path picks for a community.

I have a working implementation (spawn, spawn-config hash so community edits trigger the auto-restart flow, per-pair status/readiness, validation, tests) and will open a PR referencing this issue.

Describe alternatives you've considered

Additional context

Observed on Buzz Desktop 0.5.3 (macOS), two communities on one install. Happy to share forensic detail (process env captures, spawn logs) if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions