Skip to content

feat(workspace): a steward's proposal — MCP tool, addressee-only ask, "waiting on" in Operations and on the project (ent#980) - #3996

Merged
dolho merged 2 commits into
devfrom
feature/ent980-steward-proposals
Oct 30, 2026
Merged

dolho merged 2 commits into
devfrom
feature/ent980-steward-proposals

Conversation

@dolho

@dolho dolho commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Public half of abilityai/trinity-enterprise#980 (backend: abilityai/trinity-enterprise#982). A Workspace project's steward agent proposes members, agents, steward, visibility and task owners; the project's creator approves once in the Inbox, and Approve applies exactly what was proposed.

  • MCP — propose_project_changes (tools/projects.ts, client.ts). Access-policy row baselined: the agents it names are never acted on by the caller — the backend checks them against the creator's roster, nothing happens until the creator approves, and adding another owner's agent still raises that owner's consent ask.
  • Addressee-only gate asks. gate-addressee-only- is ADDRESSEE_ONLY_ID_PREFIXES (operator_queue_service.py:386, matched by is_addressed_to): such a row is listed and opened only by the person it is addressed to and by admins. The rule applies in the SQL behind the list and total, and on every door that reads a row: GET /{id}, /agents/{agent_name}, respond, cancel and bulk-cancel. A proposal names people and tasks of a project that the agent's owner, or someone it is merely shared with, may not be able to open, so owner-only was not enough. Still under gate-, so it stays about-a-person and reserved. workspace-problem- stays owner-only.
  • "Waiting on" instead of a refusal. The queue lists an ask to anyone who can use its agent, but a platform-raised approval is ended only by the people it was addressed to (ask_service.may_end). ask_service.addressed_view returns {waiting_on, can_decide} from that same predicate and the operator's person view carries it as addressed. QueueCard and /m then offer no Approve / Decline and say "Waiting on [email protected]. Only they can decide this, from their Workspace Inbox." Before, an admin saw the buttons and learned only from the error that the decision was not theirs. This applies to every addressed gate approval (an agent owner's consent ask reads the same way); a skill gate's own card still wins where present.
  • Project page. The Steward card shows a tinted Waiting on you block (or Waiting on <email> for other members) with Review in Inbox straight to the decision.
  • Docs. User guide (Workspace projects), the projects.manage rows in requirements/auth.md and feature-flows/self-change-grants.md, feature-flows/operating-room.md, architecture/workspace.md.

The enterprise submodule pointer is not bumped here; that follows as the usual chore(enterprise) bump once abilityai/trinity-enterprise#982 merges.

Tests

  • Backend: tests/unit/test_ent980_owner_only_gate_ask.py through the real router — a shared non-owner does not list the proposal while still listing an ordinary gate approval; owner and admin do; addressed is can_decide: false for the admin, true for the addressee, absent on an agent's own approval. test_ent715_queue_person_fields.py's field-set guard now names addressed; test_ent866's subset check compares prefixes. 708 passed across the queue/ask suites.
  • MCP: projects.test.ts (forwarding + named refusals); the whole MCP suite 1002 passed, including the access-policy totality check.
  • Frontend (mounted): queueCardAddressed.mount.spec.js, mobileAdminGateCard.mount.spec.js (+2), workspaceProjectsEnt980.mount.spec.js. npm run test:unit green apart from mobileAdminQueueWalk3302.spec.js, which failed in full-suite runs here and passes alone every time (not checked against unchanged dev; it touches none of these files); raw-colour ratchet unchanged; check:tokens OK.
  • End to end on a live stack (both repos, PostgreSQL, the real MCP server and UI): with the prefix change removed, a shared operator does see the proposal; with it, he does not. Screenshots of the Steward card and the Operations card in both themes were checked by hand.

Related: abilityai/trinity-enterprise#980 (closes at release, cross-repo)

🤖 Generated with Claude Code

…iting on" in Operations and on the project (ent#980)

The public half of Abilityai/trinity-enterprise#980: a project's steward agent
proposes members, agents, steward, visibility and task owners; the project's
creator approves once in the Inbox.

- MCP: propose_project_changes (+ client method, access-policy row:
  `agents` are never acted on by the caller — the creator approves and
  another owner's agent still needs that owner's consent).
- Operator queue: `gate-owner-only-` joins OWNER_ONLY_ID_PREFIXES, so a
  proposal naming people and tasks is listed to the agent's owner and admins,
  never to someone the agent is merely shared with.
- ask_service.addressed_view: who a platform-raised approval waits on and
  whether THIS person may decide it (may_end's own answer), carried on the
  operator's person view as `addressed`. QueueCard and /m show "Waiting on
  <email>. Only they can decide this…" and no controls, instead of a refusal
  after the click.
- Workspace: the project Steward card's tinted "Waiting on you" block with
  "Review in Inbox" for the person it waits on.
- Docs: user guide, projects.manage grant tables, operating-room flow,
  workspace architecture.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dolho dolho added the ui PR touches the frontend UI — triggers Playwright e2e tests label Oct 27, 2026

@AndriiPasternak31 AndriiPasternak31 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.

Reviewed at 6ea76fcdbbade5d6a26f2283575d147921cc4836, as one feature with abilityai/trinity-enterprise#982.

Most of this half does what the body says. The addressed view comes from the same may_end predicate the sink uses, so a card can't offer a control the backend would refuse. /m matches desktop. The MCP tool's body matches the backend half field for field (members ≤20, agents ≤10, steward {kind, ref}, visibility, task_owners ≤25 with task ids ≤16, note ≤500), and pending_proposal / last_proposal reach the agent because get_project and get_steward_digest pass the backend response through unchanged. One thing blocks: the new prefix shows the proposal to the wrong people in one supported project shape.

What I ran at this head

  • tests/unit/test_ent980_owner_only_gate_ask.py, test_ent715_queue_person_fields.py, test_ent866_problem_report_owner_only.py: 137 passed.
  • MCP npm test: 1002 passed.
  • queueCardAddressed.mount.spec.js, mobileAdminGateCard.mount.spec.js, workspaceProjectsEnt980.mount.spec.js, plus the raw-colour and loading-gate ratchets: 31 passed.
  • The backend half's proposal tests against this branch (not only dev): green. A proposal driven through the real ask_service (raise, then a non-addressee's Approve refused with AskNotAddressee, then the creator's Approve applied once) gives is_owner_only and is_about_a_person both true and addressed_view = {waiting_on: [creator], can_decide: true} for the creator and false for anyone else.

Blocking

1. gate-owner-only- shows the proposal to the steward agent's owner, and hides it from the person it is addressed to. src/backend/services/operator_queue_service.py:383. It plugs into an existing rule: _hidden_from at src/backend/routers/operator_queue.py:93, and its SQL twin at src/backend/db/operator_queue.py:1271-1275.

The owner-only rule is keyed on who owns the agent. That fits a client's complaint. A proposal, though, is addressed to the project's creator, and the creator doesn't have to own the steward: a project's steward can be an agent that is only shared with them. In that case:

  • Alice creates a members-only project and makes corbin its steward. Bob owns corbin and has shared it with Alice. Bob is not a member of the project. corbin proposes some members and task owners.
  • Bob's Operations and /m list the proposal, including the project name, the member emails, and the task ids and titles. Bob can't open the project. This is the disclosure the prefix is meant to prevent: in the PR body's words, a proposal "names people and tasks of a project that someone the agent is merely shared with may not be able to open". Owning the agent doesn't change that. Bob also can't act on the row: may_end gives Bob no Approve or Decline, and only an admin may cancel.
  • Alice is the only person who can decide it, but Operations and /m hide it from Alice, because Alice doesn't own the agent. So the comment at operator_queue_service.py:378-381 ("hiding it here hides it from nobody it is for") doesn't hold. Alice's Workspace Inbox still lists it.

How I checked: with this PR's own fixture, I re-addressed the gate-owner-only-project-proposal-ppr_1 row to the shared operator client-b and listed the queue as client-b. The result was only gate-skill-1 and plain-1. test_the_owner_and_admins_still_list_it already pins the other half: the owner lists the row even when it is addressed to someone else. I confirmed against the backend half that an owner who isn't a member can't open a members-only project.

Suggested fix: scope this prefix by addressee, not by owner. List it to the person it is addressed to (addressed_to_email, compared case-insensitively the way the Workspace Inbox already filters) and to admins, in all three places the owner-only rule applies: the SQL condition behind the list and total, and _hidden_from for GET /{item_id} and /agents/{agent_name}. workspace-problem- stays owner-only as it is. Tests should cover four things: a shared addressee lists and opens the row, an owner who isn't the addressee does neither, an admin still does, and total stays exact. If you rename the prefix, the backend half has to change in the same step, because it builds the request id.

Non-blocking

2. "Review in Inbox" is a plain <a :href>. src/frontend/src/components/portal/projects/ProjectStewardCard.vue:43-49 and :112-117. The other Inbox link on the project page (ProjectNeedsYou.vue) is a router-link built by askInboxRoute() with INBOX_LINK_CLASS. This one reloads the whole Workspace on click instead of routing. Its hand-copied class also drops the 44px touch target that INBOX_LINK_CLASS carries (max-sm:min-h-11 [@media(pointer:coarse)]:min-h-11). askInboxRoute({ id: p.ask_id, agent_name: p.proposed_by }) builds the same tab=action&from=…&item=ask:… query. I read this; I didn't click it.

3. Nit: the card's wording. ProjectStewardCard.vue:40 always says "proposed changes to people and task owners", including for a proposal that only changes visibility or the steward. "proposed changes to this project" would always be true.

Against the feature's criteria (this half's share)

  • MCP tool for the steward to propose members, agents, steward, visibility and task owners, with named refusals (already_pending, project_management_not_permitted): done and tested.
  • The proposal stays away from people who may not be able to open the project: not yet, see 1.
  • Honest status, "waiting on " on the project page: done in the Steward card. Operations says "Waiting on …" with no controls for anyone who can't decide.
  • Beyond the feature: the addressed view applies to every addressed gate approval, not only proposals; an owner's consent ask now reads "Waiting on …" too. That's documented in the body and in architecture/workspace.md, and I think it's a good change.

If the halves land separately

  • This PR alone is safe. The tool gets a 404 from a route that doesn't exist yet, and the addressed view stands on its own.
  • The other order isn't safe. If the enterprise pointer bump lands before this PR, every operator the steward is shared with lists the proposal. The bump has to come after this PR merges.

# not be allowed to see. The addressee answers it from their Workspace Inbox,
# which lists by addressee, so hiding it here hides it from nobody it is for.
# Under `gate-`, so it stays about-a-person and reserved (no agent can mint it).
OWNER_ONLY_ID_PREFIXES = ("workspace-problem-", "gate-owner-only-")

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.

Blocking (see the review, finding 1). The owner-only rule is keyed on who owns the agent, but this row is addressed to the project's creator. With a steward that is shared with the creator rather than owned by them, the agent's owner (who may not be able to open a members-only project) lists the proposal, and the creator, the one person who can decide it, doesn't see it in Operations or /m. Please scope this prefix by addressee and admins instead, in the SQL list/total condition and in _hidden_from.

{{ proposal.proposed_by }} proposed changes to people and task owners {{ '' }}<span v-if="proposal.proposed_at" :title="absolute(proposal.proposed_at)">{{ relative(proposal.proposed_at) }}</span>.
{{ waitsOnMe ? 'Nothing changes until you approve it.' : 'Nothing changes until they approve it.' }}
</p>
<a

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.

Non-blocking: a plain <a :href> reloads the Workspace on click, and the copied class drops the 44px touch target. ProjectNeedsYou.vue uses <router-link :to="askInboxRoute(...)" :class="INBOX_LINK_CLASS">, and askInboxRoute({ id: p.ask_id, agent_name: p.proposed_by }) builds the same query.

{{ waitsOnMe ? 'Waiting on you' : `Waiting on ${waitingOn}` }}
</p>
<p class="mt-1 text-sm text-gray-700 dark:text-gray-300">
{{ proposal.proposed_by }} proposed changes to people and task owners {{ '' }}<span v-if="proposal.proposed_at" :title="absolute(proposal.proposed_at)">{{ relative(proposal.proposed_at) }}</span>.

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.

Nit: this says "people and task owners" even when the proposal only changes visibility or the steward. "proposed changes to this project" is always true.

…ner's (ent#980)

Review of #3996: the `gate-owner-only-` rule was keyed on who owns the
agent, but a proposal is addressed to the project's creator, who may only
be shared on the steward. The owner (possibly unable to open the project)
listed it; the one person who can decide it did not.

Rename the prefix to `gate-addressee-only-` and scope it by addressee
(`addressed_to_email` or `resolved_to`, case-insensitive) plus admins, in
the SQL list/total condition and `_hidden_from` (GET /{id},
/agents/{name}, respond, cancel, bulk-cancel). `workspace-problem-` stays
owner-only.

Steward card: "Review in Inbox" is a router-link from askInboxRoute with
INBOX_LINK_CLASS (no Workspace reload, 44px touch target); the line reads
"proposed changes to this project".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dolho

dolho commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, AndriiPasternak31. All three findings are addressed in ddbbd6b, with the paired change in Abilityai/trinity-enterprise#982 (d73626b).

1 (Blocking): the prefix is now scoped by addressee, not by owner. Fixed in ddbbd6b.

  • I renamed the prefix to gate-addressee-only- (ADDRESSEE_ONLY_ID_PREFIXES), because "owner-only" would now describe the wrong rule. The backend half builds the new request id in the same step (d73626b).
  • A row with this prefix is listed and opened only by the person it is addressed to and by admins. "Addressed to" means addressed_to_email, or membership of resolved_to, compared case-insensitively the way the Workspace Inbox filters. The agent's owner is not included unless they are the addressee.
  • The rule applies in all three places: the SQL condition behind the list and total (_list_conditions), and _hidden_from / _hidden_for. That covers GET /{item_id}, /agents/{agent_name}, respond, cancel and bulk-cancel. The router's owner set and the caller's email now travel together as one _Fence.
  • workspace-problem- stays owner-only, unchanged.
  • Tests (tests/unit/test_ent980_addressee_only_gate_ask.py, which replaces the owner-only file). They failed before the fix and pass after it:
    • a shared addressee lists and opens the row, through both list routes and GET /{id};
    • an owner who isn't the addressee does neither;
    • an admin does both;
    • total is exact for each principal, including with limit=1;
    • the addressee is matched case-insensitively and through resolved_to;
    • predicate tests for is_addressee_only and is_addressed_to.

2: "Review in Inbox" is now a router-link. Fixed in ddbbd6b. It uses askInboxRoute({ id: ask_id, agent_name: proposed_by }) with INBOX_LINK_CLASS, so it routes inside the app and keeps the 44px touch target. The mount spec checks the to route and every class in INBOX_LINK_CLASS.

3 (Nit): wording. Fixed in ddbbd6b. The card now says "proposed changes to this project".

Docs: feature-flows/operating-room.md, architecture/workspace.md and the user doc are updated. The user doc now also says that a proposal is withdrawn when its agent stops being the steward, which is new behaviour from the backend half.

On merge order: as you noted, the enterprise pointer bump has to land after this PR.

Tests I ran:

  • test_ent980_addressee_only_gate_ask.py, test_ent866_problem_report_owner_only.py and test_ent715_queue_person_fields.py: 141 passed.
  • workspaceProjectsEnt980, queueCardAddressed and mobileAdminGateCard mount specs, plus the raw-colour and loading-gate ratchets: 31 passed.
  • The backend half's test_980_steward_proposals.py and test_661_projects.py, run against this head: 76 passed.

🤖 Generated with Claude Code

@AndriiPasternak31 AndriiPasternak31 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.

Reviewed at ddbbd6b556de703c552b4dc6b24987e69db7f9f5, as one feature with abilityai/trinity-enterprise#982 at d73626b.

All three findings are fixed, and the fix holds against the backend half. A proposal is now listed and opened only by the person it is addressed to and by admins. That rule applies in the SQL behind the list and total, and on every door that reads a row: GET /{id}, /agents/{agent_name}, respond, cancel and bulk-cancel. workspace-problem- stays owner-only. Approving.

What I ran at this head

  • test_ent980_addressee_only_gate_ask.py, test_ent866_problem_report_owner_only.py, test_ent715_queue_person_fields.py: 141 passed. Every unit file that touches the queue (73): 2413 passed, 7 xfailed.
  • Extra probes of mine, not in the PR: the owner's respond and cancel give 404, bulk-cancel skips the row and it stays pending; the broad list with no agent filter keeps total exact; a mixed-case login email still matches; the shared addressee can Approve from Operations; an admin can cancel but not approve. 5 passed.
  • The case from my review, end to end. The backend half's proposal path raised the ask through the real ask_service; the steward was then owned by Bob and shared with Alice, the creator, and Bob was not a member. The real router gave Alice (listed, total 1, GET 200), Bob (not listed, total 0, GET 404) and an admin (listed, 200). Alice's addressed is {waiting_on: [alice], can_decide: true}. The same probe against 6ea76fcdb lists it to Bob, so it tells the two heads apart.
  • Mutations: turning off the SQL condition or the _hidden_from branch fails the new tests, so each guard is load-bearing.
  • The backend half's test_980_steward_proposals.py + test_661_projects.py against this head: 76 passed. MCP npm test: 1002 passed. The three mount specs plus the raw-colour and loading-gate ratchets: 31 passed. The fence tests on a trial merge with current dev: 146 passed.
  • I did not run the new SQL on PostgreSQL. It reuses the fragments the Workspace Inbox already runs there. I did not click the new link; the mount spec checks its route and classes.

Fixed

1. The prefix is scoped by addressee. ADDRESSEE_ONLY_ID_PREFIXES at src/backend/services/operator_queue_service.py:386, matched by is_addressed_to (:403). It is applied in src/backend/db/operator_queue.py:1283-1290 and through _Fence / _hidden_from at src/backend/routers/operator_queue.py:83-127. The backend half builds gate-addressee-only-project-proposal- in the same step, so the two halves agree on the id.

2. "Review in Inbox" is a router-link from askInboxRoute with INBOX_LINK_CLASS (ProjectStewardCard.vue:43-49, :116-119).

3. The card says "proposed changes to this project" (ProjectStewardCard.vue:40).

Before merge (non-blocking)

  • The PR title and the Summary's "Owner-only gate asks" bullet still describe the old rule: gate-owner-only-, listed to the agent's owner, "hides it from nobody it is for". dev squash-merges, so that text becomes the commit message. Please update both to the addressee rule.
  • Merge order is unchanged: the enterprise pointer bump lands after this PR. With the bump first, every operator the steward is shared with lists the proposal.

Not raised: GET /stats still counts the row for anyone who can use the agent, and clear-resolved can clear an ended one. Both have worked the same way for workspace-problem- since #866, and neither shows the row's content.

@dolho dolho changed the title feat(workspace): a steward's proposal — MCP tool, owner-only ask, "waiting on" in Operations and on the project (ent#980) feat(workspace): a steward's proposal — MCP tool, addressee-only ask, "waiting on" in Operations and on the project (ent#980) Oct 30, 2026
@dolho

dolho commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Done (re @AndriiPasternak31): the title and the Summary bullet now describe the addressee-only rule (gate-addressee-only-, listed and opened only by the addressee and admins, on every door), so the squash message is right. Merge order is unchanged: the enterprise pointer bump lands after this PR.

@dolho
dolho merged commit be2b66a into dev Oct 30, 2026
30 checks passed
dolho added a commit that referenced this pull request Oct 30, 2026
…oject tools (ent#1024)

Landed on dev (#3996) after this branch wired the project tools; same
clientFor rule, and agent_name never travels in the proposal body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vybe pushed a commit that referenced this pull request Nov 6, 2026
…tyai/trinity-enterprise#1024) (#4110)

* feat(auth): an admin's user MCP key acts on behalf of an agent (Abilityai/trinity-enterprise#1024)

Operator ruling: "admin user key should be able to do whatever it
wants." The self-acting tools refused every key without an agent
identity, so a local hub on the admin's key could not raise an ask,
report, record metrics, write a canvas or touch a project.

Backend: get_current_user admits X-Trinity-Act-As-Agent for a
user-scoped MCP key whose user is an admin (admit_act_as) and refuses
it with a named 403 for every other principal; an admitted request
writes one acted_as_agent audit row naming the acting user and the
agent. get_self_acting_agent and assert_own_agent hold the admitted
principal to that agent's path. On-behalf ask audit rows carry
acted_by: user:<id>.

MCP: every self-acting tool (asks, report, metrics, canvas, projects)
takes agent_name. resolveActingAgent keeps agent/system keys acting as
themselves (naming another is refused) and returns the named agent for
a user key, whose requests go through a TrinityClient.asAgent clone
carrying the header. agent_name never travels in a body. Policy rows
move to in-tool (ACT_AS).

The project routes' half is a separate trinity-enterprise PR that
needs this on dev first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(mcp): propose_project_changes takes agent_name like the other project tools (ent#1024)

Landed on dev (#3996) after this branch wired the project tools; same
clientFor rule, and agent_name never travels in the proposal body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(auth): pin the act-as hand-off through the real door (Abilityai/trinity-enterprise#1024)

Every test called `admit_act_as` directly, so deleting the call in
`get_current_user` left them green. New tests go through the real dependency.

`ask_for_credential` told a user key to pass a parameter it doesn't have. It now
says it needs an agent key, since credentials stay out of act-as. Tool text and
docstrings that said "no agent parameter" now match the schema, the `replaced`
audit row carries `acted_by`, and the `/cso --diff` report is in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): keep ask_operator under its description cap (Abilityai/trinity-enterprise#1024)

The previous commit's wording took it past the 1,800-character guard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: trinity-ability <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants