Repository navigation
feat(assignments): the OSS seam and the execution-context fields — who fills which role - #2596
Conversation
…e rename sweep The edition-agnostic half of role assignments (trinity-enterprise#500). Inert on its own: no provider is registered in a core build, so `resolve_assignment` returns None, the three new `ExecutionContext` fields stay None, and the prompt block renders byte-identically to today. * `services/assignment_provider.py` — the seam, in the `mfa_gate` / `a2a_gate` shape (Protocol + register/get/clear + a resolve function). The SEAM owns the failure handling, not the provider: `compose_system_prompt` has no exception handler and all three of its callers lose the execution-context block if this raises (one loses the platform prompt entirely). A malformed non-raising answer is validated separately, because try/except cannot see a `str` where a list was promised — it would iterate into single characters and render the wrong prompt without raising. * `platform_prompt_service.py` — `primary_user_display` / `role_id` / `stakeholders` / `proactive_consent`, auto-filled as ONE provider call beside collaborators and platform_url. `needs_assignment` joins the `replace` guard, not just the value: a caller that pre-filled both existing fields would otherwise skip the block and the new fields would silently never render. The primary line requires a display NAME — never an email, because this block reaches anonymous public-link and paid turns. * `db/agent_cleanup.py` — `cascade_rename` now sweeps `EXTRA_AGENT_REFS`, which its own docstring already promised it did. A registered private table kept the OLD agent name across a rename, so the agent lost its rows and a later agent taking the freed name inherited them — the recycled-name cross-wire `delete_reports_to_refs` exists to prevent, one function below. * `operator_queue_service.py` — `ROLE_DRIFT_ALERT_PREFIX`, reserved so an agent cannot pre-create and ON CONFLICT-silence the alert about its own role file, which lives in its own writable workspace. * `enterprise-docs-guard.yml` — the new seam file joins `SEAM_FILES` and both path filters, so a leak in its docstring fails the build instead of shipping green (#1461's lesson). Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
The third surface for role assignments (Invariant #13, trinity-enterprise#500): tool module + client method + server registration, plus the tests. Read-only, and that is structural rather than a v1 scope cut: creating an assignment is a GRANT, and the backend refuses every non-interactive principal on the write path, so an MCP write tool would be one that can only ever fail. Narrower than credential_vault.ts on purpose. That module branches on the detail SHAPE because its backend raises coded refusals; this route raises none — its failures are the entitlement 403 (plain-string detail) and a UNIFORM 404 that covers "route absent" and "no such agent / no access" alike. The 404 is uniform for enumeration safety, so the tool merges those cases in its message instead of claiming a distinction it does not have. Registered in the operatorOnly group, whose allow-list includes `agent` — which is exactly why the backend self-scopes an agent principal to its own roster. Advertisement is not authorization, and an agent-scoped key resolves to its owner carrying the owner's role. Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
…cross-wire Four public files, and each one exists for a failure that ships GREEN without it. * `test_ent500_assignment_provider.py` — no provider / a raising provider / a malformed non-raising answer all degrade to None. The third is the one try/except cannot give you: a `str` where a list was promised iterates into single characters and renders the WRONG prompt without raising, which is strictly worse than a missing line because nothing looks broken. Also asserts the seam file is in enterprise-docs-guard's hardcoded SEAM_FILES and in BOTH path filters — an omission there is invisible forever (#1461). * `test_ent500_execution_context_fields.py` — rendering, bounds, and the two wiring properties that would otherwise fail silently: the provider is called exactly ONCE per compose, and `needs_assignment` is part of the `replace` guard, so a caller that pre-filled collaborators AND platform_url still gets the assignment lines. Plus: a raising provider still yields the full block, platform prompt included. * `test_ent500_public_turn_no_pii.py` — an outside turn renders no assignment line, an inside turn still does, an unrecognised label is suppressed by default, and the answer contract has no email-shaped key at all. Pins the fact the suppression rests on: a Workspace/portal turn is labelled `public`, so there is no third label to remember — asserted over the source, so a new outside surface under its own label fails here instead of disclosing. * `test_ent500_cascade_rename.py` — verified to FAIL on the pre-fix `cascade_rename` (3 of 5 red), using a table deliberately absent from the OSS MetaData, because a test against an OSS table passes on the broken code. Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
Rule #1's requirements-first pass, plus the architecture and flow updates. The public tree describes the generic open-core seam only — the record itself, its schema and the module that owns it stay in the private repo. * `requirements/infrastructure.md` §12.6.2 — the four execution-context fields live beside §12.6.1, which is where execution-context injection is actually documented (the plan named core-agent.md; that is not its home). * `architecture/backend.md` — the seam entry beside the other open-core seams, and a paragraph on the agent-cascade registry stating why BOTH lists are swept by BOTH paths, with the recycled-name inheritance that made it matter. * `architecture/mcp-server.md` — the tool count RECOUNTED (129 across 33), not incremented: it read 121/30 and the table was already missing `canvas.ts` and `credential_vault.ts`, so those rows land too and the count is true again. * `feature-flows/role-assignments.md` — the new flow. * `feature-flows/execution-context-injection.md` — the two new lines in the block, the auto-resolved list, the `replace`-guard contract, the per-field bounds and the audience gate, and the tests. * `feature-flows.md` — Recent Updates row + a Collaboration & Permissions row. Deliberately NOT added: a route row under api-endpoints.md's Enterprise Modules section. That section ends with the standing rule that the module catalog is not documented publicly, and the credential-vault routes are absent for the same reason. The seam and the OSS tool are public; the module is not. enterprise-docs-guard re-run locally over docs/ + CLAUDE.md + all six seam files: clean. Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
…ect the claim Two things, and the second matters more than the first. **The correction.** The previous commit here said `cascade_rename`'s missing `EXTRA_AGENT_REFS` sweep meant a registered private table kept the OLD agent name after a rename, so the renamed agent lost its rows and the next agent to take that name inherited them. That was overstated. Reading every caller — `db/agent_settings/metadata.py::rename_agent` is the only production one — shows it carried its OWN `EXTRA_AGENT_REFS` loop (ent#46) immediately after the `cascade_rename` call. The rename endpoint was correct the whole time. Corrected in the docstring, `architecture/backend.md`, `role-assignments.md`, `agent-rename.md` and the Recent Updates row. **What was actually wrong, and the fix.** The behaviour lived in the CALLER while `cascade_rename` — the shared function whose contract advertised it — did not do it. That is exactly what made it survivable and exactly what made it worth fixing: a cross-repo module author reads `register_agent_owned_table`'s docstring, not one caller's body, and a second caller of `cascade_rename` would have silently dropped the sweep. The #1819 shape one level down — two places answering one question. So this is a CONSOLIDATION, not a bug fix: the sweep now lives in `cascade_rename` (previous commit) and the duplicate loop in `rename_agent` is deleted here. Leaving both would have been a third copy, and a redundant pass is how the two lists drifted apart in the first place. Tested at both levels, because moving a loop is otherwise an unverified refactor of the one path that mattered: `cascade_rename` re-keys a registered table; the production `rename_agent` path still re-keys after the move (verified RED with the shared sweep removed — 4 of 7 fail, including the caller-level test); and a structural guard forbids `rename_agent` regrowing a loop of its own. Found by the doc pass, not by a test — which is its own small argument for writing the flow doc rather than only the code. Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
The provider's allow-list dropped `mcp`, `agent` and `room` (each has a reader who may be outside the organisation) and gained `manual` / `retry` while losing the dead `task`. The public contract test's stub mirrors that rule, so it should say the same thing. Adds a case for the three transitive/ambiguous labels specifically, because the source scan beside it CANNOT catch them: no outside-facing router emits `mcp`, `agent` or `room`, so asserting that `public.py` / `paid.py` / `client_portal/service.py` use only the suppressed set says nothing about them. Two different gaps, two different checks. Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
…der owns "never an email" The public flow doc claimed an address "cannot ride in even by a provider's mistake" because the answer contract has no email-shaped key. The provider found out otherwise: a display name resolved from an account whose only name-shaped column IS its address is a `str`, and it passes every check the seam makes. The seam validates types, not contents, so the property has to hold where the value is resolved. Both the doc and the seam docstring now say which side owns it. (The provider-side fix is in the private module.) Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W6P6bjT1RRiHosQCAEgJE7
… predicates, and value-vs-field-name contracts Refs trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W6P6bjT1RRiHosQCAEgJE7
…flow /validate-pr's feature-flow format check wants a status indicator on the Testing section — the one thing a reader cannot reconstruct from the file list. States what was actually run (71 assertions across three pytest-randomly seeds, 326 mcp-server tests, the 14456-test unit island) and, separately, that the cascade_rename suite was verified RED against the pre-fix code: "there is a test" and "the test would have caught it" are different claims and only the second is worth writing down. Refs Abilityai/trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W6P6bjT1RRiHosQCAEgJE7
9e77626 carried a `src/backend/enterprise` gitlink bump along with its code change. It is invisible in a normal `git diff` because this clone sets `ignore = all` on the submodule, which is exactly how it got past the working-tree check. It must not be here. The gitlink bump is its own PR, opened only after the private one merges, and it is the moment the feature actually goes live — not this PR, which is inert by construction. Worse, the pinned commit is local-only: it is on no remote branch, so any clone that did initialize the submodule would fail to resolve it. Restored to the commit `dev` pins. Net diff for the submodule is now empty; the working-tree submodule is left where it was. Refs Abilityai/trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W6P6bjT1RRiHosQCAEgJE7
…does CI seed 99999 failed `test_the_production_rename_path_still_rekeys_a_registered_table` with `(1, 0) == (0, 1)` — the probe row never moved — while seeds 12345 and 67890 and every isolated run passed. The rename itself returned True, so the production path was fine; the test was looking at the wrong registry. `registry_isolated` resolved the module with `from db import agent_cleanup`, which reads the `db` package ATTRIBUTE. The production call site does `from db.agent_cleanup import cascade_rename` inside `rename_agent`, which goes through `sys.modules` at call time. Those two diverge in a suite that drops the module from `sys.modules`: the package attribute keeps pointing at the stale object, so the registration lands on a list nothing reads, the sweep finds an empty registry, and the row stays put. The test then reports the exact wording of the regression it was written to catch — an isolation failure wearing a real bug's face, which is the expensive kind. Resolved via `importlib.import_module` so both sides agree by construction. Also asserts the two pieces of process-global state the test does not own — that the probe table is in the registry the production path actually reads, and that it is visible on the engine the rename will use — BEFORE the rename. Both fail the same way at the final assert, so without this a future isolation break impersonates a rename regression again. Refs Abilityai/trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W6P6bjT1RRiHosQCAEgJE7
dolho
left a comment
There was a problem hiding this comment.
/review — PR #2596 (AndriiPasternak31/ent500 → dev)
Files: 24 (+2332/−66) · Scope: CLEAN — the OSS half only, inert without a provider, and the PR says so in the one place it matters (resolve_assignment → None → the block renders byte-identically).
Verified locally: pytest tests/unit/test_ent500_*.py → 71 passed. MCP TS suite not run (no node_modules in the worktree) — the vitest files read correctly and tool-visibility.test.ts pins the operatorOnly allow-list membership plus a "no write tool in this module" assertion, which is the right pair.
Three things I checked rather than took on trust:
- The
needs_assignmentguard fix is real, not theoretical.if ctx.collaborators is None or ctx.platform_url is Nonegenuinely skips the wholereplaceblock for a caller that pre-fills both, and the four new fields would then never resolve — for that caller only, which is the worst shape of bug to find later. Adding it to the guard and using it to gate the provider call (so it stays one call, not four) is exactly right. - The audience allow-list actually closes. I traced every non-listed turn label:
adapters/message_router.py:721passestriggered_by=channel(telegram/slack/whatsapp/voip) androuters/a2a.py:400passes"a2a"— none of them in the stub'sALLOWED, so all suppress by construction. That is the payoff of an allow-list over a deny-list, andtest_a_missing_trigger_label_is_suppressedcovers theNonecase too.test_outside_facing_surfaces_use_only_suppressed_trigger_labelspinning the fact over the sources — rather than restating the policy — is the part that will still be true in a year. cascade_renameconsolidation is safe.db/agent_settings/metadata.py::rename_agentis the only caller insrc/(grepped),textis still used elsewhere in that module so no orphaned import, and_table_existsskips absent private tables. The PR's own correction — "the plan claimed a live disclosure; that was overstated" — is worth more than the fix.
_validated checking the answer shape is the right call and the stated reason is the right reason: a str where a list was promised iterates into single characters and renders a wrong prompt without raising, and try/except structurally cannot see that.
Critical
None.
Informational
[I1] proactive_consent is None renders a bare name — fail-open on the one field that is a permission statement (Confidence: 8/10)
src/backend/services/platform_prompt_service.py:_render_assignment
if ctx.proactive_consent is not None:
line = f"{line} — proactive contact permitted" if ctx.proactive_consent else f"{line} — proactive contact NOT yet permitted; …"
return lineThe docstring states the intent precisely:
Consent is appended as an explicit qualifier rather than left blank — the agent must not infer permission to reach out from the mere presence of a name
But when the bit is absent the qualifier is omitted and the line renders as bare A. Smith (role: head-of-ops) — which is exactly "a name with no qualifier", i.e. the inference the docstring forbids. And it is reachable through the documented contract, not a malformed answer: _validated skips None values, so a provider answering {"primary_user_display": …, "role_id": …} and nothing else lands here. Your own test stub returns exactly that shape (_SuppressingProvider.assignment_for), so the reachable case is already in the suite.
The fail-closed reading is that a permission-shaped field defaults to not permitted: either render the restrictive clause when proactive_consent is None, or require it alongside a display name the way _render_assignment already requires the name for the role. Cheap either way, and it is the difference between "the model was told no" and "the model was told nothing" on a field whose whole purpose is to stop unprompted outreach.
(Related, same area: needs_assignment deliberately excludes proactive_consent from its three-field test. That is fine on its own — a caller pre-filling only the consent bit should still get the rest resolved — but it means the bit and the name can arrive from different places, which is another route to the bare-name render above.)
[I2] The MCP tool's description asserts a rule the OSS code does not enforce (Confidence: 7/10)
src/mcp-server/src/tools/assignments.ts
"Call it with your OWN agent name to find out who you work for — an agent may only read its own roster."
Nothing in this module checks that. The enforcement is the backend route's, and that route lives in the private submodule — so in an OSS build the claim is vacuously true (404, route absent) and in an entitled build it is true only for as long as the other repo remembers. Every sibling in the architecture doc narrows at the MCP layer for precisely this reason, and a2a_call.ts is the direct precedent — its comment reads "Agent-scoped gate is self-only, matching the backend", i.e. deliberately redundant with it.
McpAuthContext already carries agentName, so the check is three lines and costs nothing when the scope is not agent. The module's "license-blind proxy" framing argues against duplicating entitlement policy — I agree — but a self-scope check is not an entitlement question. Worth either adding it or replacing the sentence with what the tool actually guarantees.
[I3] degrade() returns the raw error text to the agent (Confidence: 6/10)
src/mcp-server/src/tools/assignments.ts (detail: raw)
human is a curated per-status sentence — good — but detail carries error.message verbatim on the else branch, which is the unexpected-status path where a backend body or an internal URL is most likely to be in it. The reader is the agent (owner-scoped), so this is not a disclosure across a tenant boundary; it is the same "don't hand foreign text to a model unfiltered" hygiene the rest of this PR observes carefully (_sanitize_field on every rendered value). Consider dropping detail on the fallback branch, or capping it.
Clean
- The seam owns failure handling, not the provider — and the justification is verified, not asserted:
compose_system_prompthas no exception handler andpull_coordination_servicewould lose the whole platform prompt. Degrading toNone(not raising, not partially rendering) is the safe direction, andclear_provider()existing because the suite runs underpytest-randomlyis the kind of reason that keeps a fixture from being deleted as noise later. _ANSWER_KEYSis an allow-list, so a provider cannot smuggle an unrendered key into the prompt path.- Synchronous by design, with the reason stated (
compose_system_promptis a syncdefon the async request path, so a blocking provider stalls the worker loop). That constraint is easy to lose in a later refactor — good that it is in the module docstring rather than a commit message. - Field-length constants are separate from
MAX_FIELD_LENwith a stated reason (a name truncated mid-word is worse than a long line), and every rendered value still goes through_sanitize_field, so control characters / backticks / heading markers cannot reach the prompt. - Reserved id prefix:
ROLE_DRIFT_ALERT_PREFIXas a named public constant, with the deviation from the house convention explained by the fact that the emitter is cross-repo. The reservation reason — the role file lives in the agent's own workspace, so an unreserved prefix would let it pre-create andON CONFLICT-silence an alert about its own configuration — is the C2 class, correctly identified. - Open-core rule (CLAUDE.md):
role-assignments.mdopens by scoping itself to the OSS half and stating the record is not documented here; the seam file joinsSEAM_FILESand bothpaths:filters inenterprise-docs-guard.yml, so CI is the arbiter rather than reviewer memory. This is the borderline that guard exists to police and it is on the right side of it. - Auth: no new backend endpoint, no dependency change; the MCP tool registers in the
operatorOnlyallow-list rather than a deny-check (the #848 lesson).
Summary
Critical: 0 · Informational: 3 · Scope: clean.
Approving. [I1] is the one I'd like before the gitlink bump that makes this live — it is a permission statement failing open, and the fix is one branch. It changes nothing in an OSS build (no provider, nothing renders), so it does not need to hold this merge.
|
✅ Nightly unit-suite clean when this PR is merged into |
|
Resolve by merging |
Three conflicts, all "both sides appended at the same anchor": - `operator_queue_service.py::_RESERVED_ID_PREFIXES` — dev added `"gitignore-untracked-"` (#2529) and this branch added `ROLE_DRIFT_ALERT_PREFIX` (ent#500). Independent reservations; both kept. Dropping either would un-reserve a prefix an agent could then pre-create, which is the whole point of the tuple. - `docs/memory/feature-flows.md` — newest-first, so dev's 09-08/09-07 rows precede this branch's 09-07 ent#500 row. - `docs/memory/learnings.md` — append-at-bottom, so this branch's two 09-07 entries sit after dev's 09-07 group and before its 09-08 group. Both submodule gitlinks resolve to dev's pins (`.claude` takes dev's #2631 bump; `src/backend/enterprise` stays at `fd25b47`, unmoved by this PR). Verified: 138 passed across the ent#500 suites and the operator-queue reserved-id/caps/quarantine suites that guard the merged tuple. Refs Abilityai/trinity-enterprise#500 Co-Authored-By: Claude Opus 5 <[email protected]>
…sed consent, gitlink bump (Abilityai/trinity-enterprise#500) (#3034) * fix(assignments): unresolved proactive consent fails closed (trinity-enterprise#500 [I1]) _render_assignment appended the consent qualifier only when proactive_consent was not None, so a provider answering {primary_user_display, role_id} and nothing else -- a valid answer, since _validated skips absent keys -- rendered a bare name. That is the inference the function's own docstring forbids: a name with no qualifier reads as permission to reach out. Only an explicit True now renders "permitted"; False and None both render the restrictive clause. The compose-time merge in compose_system_prompt is left as is: it preserves None, which the renderer now closes, and no src/ caller pre-fills the fields. dolho's go-live condition from the #2596 review. * feat(mcp): register get_agent_assignments again -- reverse the 0.9.5 fence (#2863) (trinity-enterprise#500) #2863 withheld the tool from toolGroups for the 0.9.5 cut because the assignments layer had no backend. PR2a (trinity-enterprise#669) ships that layer, so the registration, the access.ts policy row and the presence pins in tool-visibility.test.ts return, along with the doc text #2863 replaced (restored verbatim from its diff). Must not merge before the enterprise gitlink bump: on a build without #669 the tool is advertised but always answers "not available". * fix(mcp): get_agent_assignments never echoes the raw error text (trinity-enterprise#500 [I3]) degrade() returned `detail: error.message` beside the curated message. On the unexpected-status branch that is a raw backend body or an internal URL, handed unfiltered to a model. Drop the field on every branch; the curated per-status sentence is the whole answer. dolho's [I3] from the #2596 review. * fix(mcp): get_agent_assignments enforces agent self-scope in the tool (trinity-enterprise#500 [I2]) The tool description promises "an agent may only read its own roster", but only the backend route -- in the private module -- enforced it. An agent key naming another agent, or carrying no agent name, is now refused with not_authorized before any backend call and audited as a denial via accessDenied. Deliberately redundant with the backend, like a2a_call.ts checkSelf. user and system keys still pass to the backend. The access.ts row moves from baselined to in-tool. The I3 doc note for the degraded shape lands here too, in the same flow section. dolho's [I2] from the #2596 review. * fix(assignments): a non-bool consent is unresolved, never coerced (trinity-enterprise#500 [R1]) assignment_provider._validated coerced proactive_consent with bool(value), and bool("false") is True -- so a provider answering the string "false" (or "0", "no") rendered "proactive contact permitted". The same permission-fails-open class as [I1], one layer earlier. Only a real bool is kept now. Anything else is dropped with a WARNING like any malformed field, so consent is unresolved and the renderer's [I1] path states the restrictive clause. test_proactive_consent_is_coerced_to_bool pinned the coercion and is replaced. New tests were red against bool() (8 failed) and green after; the end-to-end one drives the real compose_system_prompt path with a provider answering "false". Found in the PR3 pre-push review. * docs(user-docs): count get_agent_assignments in the MCP tool totals (142 -> 143, 137 -> 138 operator) * chore(enterprise): bump the private module to trinity-enterprise#669 (Abilityai/trinity-enterprise#500) Points src/backend/enterprise at be1160f3a, the squash-merge of the assignments record and prompt (#669) on trinity-enterprise main. Adds migration 0018_agent_assignments; one enterprise Alembic head.
Refs abilityai/trinity-enterprise#500
What this is
The edition-agnostic half of role assignments — who fills which business role
for an agent, and which human it primarily serves.
Inert on its own. A core build registers no provider, so
resolve_assignmentreturns
None, the four newExecutionContextfields stayNone, and the promptblock renders byte-identically to today. It can land first and alone; the
record (table, write endpoints, provider) is a private module, and the feature
only goes live at the later gitlink bump.
services/assignment_provider.pymfa_gate/a2a_gateshapeservices/platform_prompt_service.pydb/agent_cleanup.py+db/agent_settings/metadata.pycascade_renamesweepsEXTRA_AGENT_REFS; the caller's duplicate loop is deletedservices/operator_queue_service.pyROLE_DRIFT_ALERT_PREFIX, reservedsrc/mcp-server/**get_agent_assignments— tool + client method + registration.github/workflows/enterprise-docs-guard.ymlSEAM_FILESand bothpaths:filtersThree decisions worth your attention
The seam owns the failure handling, not the provider.
compose_system_prompthas no exception handler and the
replaceblock it fills is unguarded — all threecallers lose the execution-context block if a provider raises, and
pull_coordination_serviceloses the platform prompt entirely. It also validatesthe answer shape, which
try/exceptstructurally cannot: astrwhere alist was promised iterates into single characters and renders the wrong prompt
without raising. Wrong is worse than missing, because nothing looks broken.
(
a2a_gate.py:141carries the same check for the same reason.)needs_assignmentis part of thereplaceguard, not just the value. Theguard read
if ctx.collaborators is None or ctx.platform_url is None. A callerthat pre-filled BOTH would have skipped the block entirely and the assignment
lines would silently never render — for that caller only. Tested.
The rendered identity is a display NAME. This block reaches anonymous
public-link and x402 paid turns, so an address here would be the first
third-party PII in the auto-filled context (
collaboratorsare agent names,source_user_emailis the caller's own). The answer contract has no email-shapedkey at all, and
triggered_byis forwarded so a provider can suppress on theaudience — an allow-list, fail-closed on a label nobody has thought of yet.
The
cascade_renamechange — read this, it is not what the plan saidThe plan claimed a live disclosure: a registered private table keeping the OLD
agent name after
PUT /api/agents/{name}/rename, so the renamed agent lost itsrows and the next agent to take that name inherited them.
That was overstated.
db/agent_settings/metadata.py::rename_agentis the ONLYproduction caller of
cascade_renameand carried its ownEXTRA_AGENT_REFSloop(ent#46). The endpoint was correct the whole time.
What was wrong is narrower and still worth fixing: the behaviour lived in the
caller while
cascade_rename— the shared function whose docstring advertisedit — did not do it. A cross-repo module author reads the contract, not one
caller's body, and a second caller would have silently dropped the sweep. The
#1819 shape one level down. So this is a consolidation: sweep into
cascade_rename, duplicate deleted, docstring made true, tested at BOTH levels.Verification
Everything below was run on this branch tip.
pytest unit -m "not slow", py3.12)test_agent_cleanup_parity,test_1819_rename_cascade_parity,test_models_centralized,test_1310_auth_wiring,test_293_admin_gate_rejects_agent_keys)npm testinsrc/mcp-serverenterprise-docs-guard.ymlgrep, run exactly as CI doestests/lint_sys_modules.pytest_ent500_cascade_rename.pyagainst the pre-fix codeThe 8 failures are not from this branch, and that is proven rather than
asserted. Seven are
test_736_a2a_outbound_edges+test_ent399_ipv6_originIPv4-mapped-IPv6 cases; they reproduce identically on a pristine
origin/devworktree under the same interpreter, and this diff touches no a2a, ipv6, or
url-validation file. The eighth is
test_1920_no_hand_rolled_single_flight, whichfails only because this worktree mounts the enterprise submodule — the guard
rglobs all ofsrc/backendand seesenterprise/backend/siem/exporter.py. Thebaseline worktree has zero files there and the test passes; CI never mounts the
submodule, so it is green there. It also makes
/verify-local's unit stagefail-fast — use
--skip-unit./verify-local --skip-agent --skip-unitwas PASS on this tree:import maininside the built backend image, real boot + health, integration 70 passed.
Docs
Requirements §12.6.2,
architecture/backend.md(the seam + the cascade registry),architecture/mcp-server.md(the tool row), a newfeature-flows/role-assignments.mdwith both index rows, and two updated flows(
agent-rename.md,execution-context-injection.md).One pre-existing drift I did not fix, so it does not get silently inherited:
architecture/mcp-server.md's headline count and its per-module table havedisagreed by 4 since before this branch (on
dev: headline 121, table sums 125).This PR adds exactly +8 to both sides (129 / 133) —
assignments.ts1,canvas.ts5,credential_vault.ts2, each verified against the source — so theoffset is carried faithfully, not widened. Reconciling it means auditing all 33
modules and belongs in its own change.
Not in this PR
The table, the five endpoints, the provider, and the drift loop. No gitlink bump —
that is a separate PR after the private one merges, and that is the moment the
feature goes live.
🤖 Generated with Claude Code
https://claude.ai/code/session_01W6P6bjT1RRiHosQCAEgJE7