mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
A2A switchboard (pair cards), Secretary/PM task access + closed over-permission hole, MegaTask conventions fix (#298)
* feat(tasks): Secretary full task access; PM lighter editing — and a closed over-permission hole Secretary: the CEO-gated edit directive covers the full content surface (title/description/AC/priority/team/complexity/nature + claim-aware reassignment through the real reassign paths, enum coercion, slug or UUID assignees), and read_task returns full detail (notes, plan, bounded progress, PR refs). The submit_directive tool docs never mentioned edit at all — fixed, it was undiscoverable. PMs: scouted the PATCH route and found has_higher_perms gave PM identities UNRESTRICTED admin (ASSIGN is not team-scoped) — wider than 'not that much'. Now: cell PMs hard-403 outside their team, and both PM roles are capped to the content allowlist (title/description/AC/ priority) with zero status changes via this surface. CEO/Board/Auditor keep full admin. Built subagent-driven (Sonnet 5), reviewed. * feat(a2a): the switchboard — org-chart pair cards with live activity 70 permission-matrix-derived pair cards (cells/pm-chain/board/cross), lighting on either direction's a2a.message frames with a 45s fade — A2A only, never verbs, per CEO ruling. Click-through reuses the v1 transcript + chime-in drawer; v1 list stays as the mobile fallback. One CEO-gated /a2a/chat/admin/pairs route joins the static matrix against conversations in a single bulk query. Built subagent-driven (Sonnet 5), reviewed; pre-existing agent-utils slug-map gap flagged. * fix(runtime): conventions ambient covers the MegaTask project_ids scope _resolve_intake_ambient forwarded project_ids only to the history-digest resolver — a MegaTask intake got no architectural-conventions block even with the flag on. The conventions resolver now takes project_ids first (mirroring the history resolver), both share one order-preserving _projects_by_ids helper, and a regression test pins the threading to both sub-resolvers. Built subagent-driven (Sonnet 5), reviewed. --------- Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
+53
-1
@@ -15,7 +15,12 @@ import structlog
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from roboco.agents_config import ALL_AGENTS, get_agent_skills, get_agent_team
|
||||
from roboco.agents_config import (
|
||||
A2A_ALLOWED_PAIRS,
|
||||
ALL_AGENTS,
|
||||
get_agent_skills,
|
||||
get_agent_team,
|
||||
)
|
||||
from roboco.config import settings
|
||||
from roboco.db.tables import (
|
||||
A2AConversationTable,
|
||||
@@ -26,6 +31,7 @@ from roboco.db.tables import (
|
||||
from roboco.enforcement import A2AAccessDeniedError, validate_a2a_access
|
||||
from roboco.events import Event, EventType, get_event_bus
|
||||
from roboco.models.a2a import (
|
||||
A2AAdminPairSummary,
|
||||
A2AArtifact,
|
||||
A2AChatMessage,
|
||||
A2AConversation,
|
||||
@@ -1092,6 +1098,52 @@ class A2AService:
|
||||
|
||||
return summaries
|
||||
|
||||
async def list_admin_pairs(self) -> list[A2AAdminPairSummary]:
|
||||
"""CEO switchboard: every allowed agent pair (static matrix, see
|
||||
``agents_config.A2A_ALLOWED_PAIRS``) joined with its representative
|
||||
conversation when one exists.
|
||||
|
||||
One bulk query over the bounded static pair count — never N+1. When a
|
||||
pair has more than one conversation (distinct topics), the most
|
||||
recently updated one is treated as "the" conversation for that pair.
|
||||
"""
|
||||
from sqlalchemy import tuple_
|
||||
|
||||
canonical_keys = [(p.agent_a, p.agent_b) for p in A2A_ALLOWED_PAIRS]
|
||||
conv_by_pair: dict[tuple[str, str], A2AConversationTable] = {}
|
||||
if canonical_keys:
|
||||
result = await self.session.execute(
|
||||
select(A2AConversationTable).where(
|
||||
tuple_(
|
||||
A2AConversationTable.agent_a, A2AConversationTable.agent_b
|
||||
).in_(canonical_keys)
|
||||
)
|
||||
)
|
||||
for conv in result.scalars().all():
|
||||
key = (conv.agent_a, conv.agent_b)
|
||||
current = conv_by_pair.get(key)
|
||||
if current is None or conv.updated_at > current.updated_at:
|
||||
conv_by_pair[key] = conv
|
||||
|
||||
summaries: list[A2AAdminPairSummary] = []
|
||||
for p in A2A_ALLOWED_PAIRS:
|
||||
rep = conv_by_pair.get((p.agent_a, p.agent_b))
|
||||
summaries.append(
|
||||
A2AAdminPairSummary(
|
||||
agent_a=p.agent_a,
|
||||
role_a=p.role_a,
|
||||
team_a=p.team_a,
|
||||
agent_b=p.agent_b,
|
||||
role_b=p.role_b,
|
||||
team_b=p.team_b,
|
||||
group_key=p.group_key,
|
||||
conversation_id=str(rep.id) if rep else None,
|
||||
last_message_at=rep.last_message_at if rep else None,
|
||||
message_count=rep.message_count if rep else 0,
|
||||
)
|
||||
)
|
||||
return summaries
|
||||
|
||||
async def close_conversation(
|
||||
self,
|
||||
conversation_id: UUID,
|
||||
|
||||
Reference in New Issue
Block a user