Skip to content

docs(architecture): reconcile Invariant #8 with the ent#293 gate fix (#1890, #1821) - #2062

Merged
vybe merged 1 commit into
devfrom
docs/reconcile-invariant8-ent293
Aug 9, 2026
Merged

vybe merged 1 commit into
devfrom
docs/reconcile-invariant8-ent293

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Docs only. Follow-up I committed to while approving #1890, raised there rather than pushed to that branch because eight in-flight PRs touch architecture.md and batching avoids compounding the conflict.

Why this is a defect, not tidying

#1890 moved the agent-principal rejection into require_admin/assert_admin. Invariant #8 still described the pre-fix model:

Role ≠ human (#1644, #1816): assert_admin/require_admin answer what role, never is this a human … An endpoint whose blast radius is operator-scale … needs reject_agent_principal in addition to the role gate

Both halves are now false, and the second is actively harmful: it is exactly the bolt-it-on-per-endpoint pattern #1890 eliminated after five occurrences of the class. Left standing, the doc instructs the next contributor to re-implement what was just centralised — on a security invariant, in the file CLAUDE.md Rule 7 tells everyone to read before adding an endpoint.

The helper list in the same invariant also still described assert_admin as _reject_connector_principal + role only.

What changed

  • The Role ≠ human paragraph → An admin gate is never agent-callable (ent#293/ent#297). States the gate as the mechanism; keeps the reason (an agent key resolves to its owner carrying the owner's role) since that is what makes the design non-obvious; records that per-endpoint reject_agent_principal calls are now belt-and-braces rather than the mechanism.
  • Records the two re-opened reads. POST /api/monitoring/agents/{name}/check and GET /api/subscriptions were uses, not grants. Notes specifically that the subscription read is owner-scoped, not un-gated — un-gating was the first attempt and would have handed any role=user a fleet-wide owner_email + agent-name enumeration oracle, reintroducing the Invariant security: implement safe tar extraction with symlink/hardlink validation #8 disclosure class via a fix for a different disclosure. That trap is worth being written down.
  • Writes down the new hard rule: never require_role("admin"). It rejects connector but not agent principals, and require_role stays permissive on purpose (ghost spawning goes through require_role("creator"), ent#69 Part 2). Until now this lived only in a docstring and an AST guard — findable after you have already made the mistake.
  • PUT /api/agents/{name}/label row updated for PUT /agents/{name}/label silently clears the label (200) when the body uses an unknown field name #1821: label is required-but-nullable with extra="forbid", so {} and unknown field names 422 instead of silently clearing.

Verification

  • Both statements checked against the merged code, not the PR bodies: dependencies.py require_admin/assert_admin both call reject_agent_principal; monitoring.trigger_health_check is get_current_user + AuthorizedAgentByName; subscriptions.list_subscriptions branches on role == "admin" and not agent_name.
  • Ran the enterprise-docs-guard pattern against the added lines — clean, no paid-feature or enterprise_* token.
  • No code, schema, migration, or behaviour change; nothing for /validate-config or schema-parity to act on.

Fixes are already merged (#1890, #1822); this carries no closing keyword by design — it documents them rather than resolving a separate issue.

🤖 Generated with Claude Code

…1890, #1821)

`#1890` moved the agent-principal rejection into `require_admin`/`assert_admin`
themselves, but Invariant #8 still described the pre-fix model — that the admin
gates answer "what role" and never "is this a human", and that an operator-scale
endpoint therefore needs `reject_agent_principal` bolted on *in addition to* the
role gate. That is precisely the per-endpoint pattern #1890 eliminated, so left
as-is the doc would tell the next contributor to re-implement the thing that was
just centralised, on a security invariant.

Rewrites that paragraph to describe the gate as the mechanism, records the two
admin-gated reads that were re-opened as *uses* rather than grants (and why
`GET /api/subscriptions` is owner-scoped rather than un-gated), and writes down
the new hard rule — never `require_role("admin")` — which until now lived only
in a docstring and an AST guard.

Also updates the `assert_admin` helper description in the same invariant, and
the `PUT /api/agents/{name}/label` row for #1821 (`label` is now
required-but-nullable with `extra="forbid"`; `{}` and unknown fields 422).

Docs only — no code, no schema, no behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against merged code: require_admin/assert_admin both call reject_agent_principal; trigger_health_check is get_current_user + AuthorizedAgentByName; list_subscriptions branches on role == "admin" and not agent_name. Docs-only, no closing keyword by design. Approving.

@vybe
vybe merged commit a041a9b into dev Aug 9, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants