mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
chore(board): revive dormant board wiring — research key, pitch flow, auditor playbooks (#684)
* chore(compose): pass research key/provider + provisioning token/org through to the orchestrator ROBOCO_RESEARCH_API_KEY / ROBOCO_RESEARCH_PROVIDER and ROBOCO_PROVISIONING_TOKEN / ROBOCO_PROVISIONING_ORG were absent from every compose environment stanza, so .env values never reached the container: research silently ran on the NullProvider (empty results forever) and any approved pitch died on ProvisioningDisabledError. .env.example also falsely claimed the provisioning creds are panel-managed. * feat(board): pitch CEO notification + auditor playbook-draft surfacing A proposed pitch now nudges the CEO (APPROVAL notification + Telegram link to the Pitches tab, best-effort — a send failure never fails the verb). auditor_triage surfaces the oldest pending playbook draft once anomalies are clear — the curation verbs were granted but nothing ever pointed the Auditor at the review queue; the scheduled audit prompt names the discovery path. * docs(prompts): pitch doctrine section + auditor reply-only-dm drift fix board.md never mentioned the pitch verb, so no board agent ever had a reason to call it — it gets a dedicated section mirroring the roadmap/spotlight ones, plus a roadmap-exploration escape hatch (needs-its-own-repo ideas pitch instead). product-owner.md gains its missing propose_roadmap + pitch entries. The flat 'Auditor has no dm' claims are corrected to the real grant: never initiates, reply-only in a CEO-opened thread. Doctrine guarded by a prompt-content test. --------- Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
"""Board pitch doctrine + the Auditor dm nuance are actually in the prose.
|
||||
|
||||
Guards two prompt-drift classes: the `pitch` verb had no doctrine section
|
||||
anywhere (no board agent ever had a reason to call it), and board.md /
|
||||
auditor.md both flatly claimed the Auditor has NO `dm` when role_config.py
|
||||
grants it a reply-only, CEO-thread-only `dm`/`read_a2a`.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from roboco.agents.factories._base import _get_prompts_base_path, _load_layer
|
||||
|
||||
_PROMPTS = _get_prompts_base_path()
|
||||
|
||||
|
||||
def test_board_role_prompt_documents_pitch() -> None:
|
||||
text = _load_layer(_PROMPTS / "roles" / "board.md")
|
||||
assert text, "board.md is missing or empty"
|
||||
assert "pitch(" in text
|
||||
assert "## Pitching a new product" in text
|
||||
|
||||
|
||||
def test_product_owner_identity_lists_propose_roadmap_and_pitch() -> None:
|
||||
text = _load_layer(_PROMPTS / "identities" / "product-owner.md")
|
||||
assert text, "product-owner.md is missing or empty"
|
||||
assert "propose_roadmap" in text
|
||||
assert "pitch(" in text
|
||||
|
||||
|
||||
def test_head_marketing_identity_lists_pitch() -> None:
|
||||
text = _load_layer(_PROMPTS / "identities" / "head-marketing.md")
|
||||
assert text, "head-marketing.md is missing or empty"
|
||||
assert "pitch(" in text
|
||||
|
||||
|
||||
def test_board_role_prompt_no_longer_claims_flat_no_dm_for_auditor() -> None:
|
||||
text = _load_layer(_PROMPTS / "roles" / "board.md")
|
||||
assert "The Auditor is silent: read-only, no `dm`" not in text
|
||||
assert "You have no `dm`/`escalate_*`" not in text
|
||||
assert "reply in-thread when the CEO opens a DM with it" in text
|
||||
|
||||
|
||||
def test_auditor_identity_no_longer_claims_flat_no_dm() -> None:
|
||||
text = _load_layer(_PROMPTS / "identities" / "auditor.md")
|
||||
assert text, "auditor.md is missing or empty"
|
||||
assert "You have **no** `dm` verb" not in text
|
||||
assert "only to read and reply in-thread when the CEO opens a DM" in text
|
||||
|
||||
|
||||
def test_auditor_identity_documents_playbook_discovery_via_triage() -> None:
|
||||
text = _load_layer(_PROMPTS / "identities" / "auditor.md")
|
||||
assert "pending playbook draft" in text
|
||||
assert "triage()" in text
|
||||
@@ -7,7 +7,7 @@ from __future__ import annotations
|
||||
|
||||
from datetime import UTC, datetime
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
@@ -76,13 +76,44 @@ async def test_auditor_triage_returns_idle_when_no_anomalies() -> None:
|
||||
deps = _make_deps(task=task_svc)
|
||||
c = Choreographer(deps)
|
||||
|
||||
env = await c.auditor_triage(auditor_id)
|
||||
playbook_svc = AsyncMock()
|
||||
playbook_svc.list_drafts.return_value = []
|
||||
with patch(
|
||||
"roboco.services.playbook.get_playbook_service", return_value=playbook_svc
|
||||
):
|
||||
env = await c.auditor_triage(auditor_id)
|
||||
body = env.as_dict()
|
||||
assert body["status"] == "idle"
|
||||
assert body["task_id"] is None
|
||||
assert "i_am_idle" in body["next"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_auditor_triage_surfaces_playbook_draft_when_no_anomalies() -> None:
|
||||
"""No anomalies, but a pending playbook draft — surfaced instead of idle
|
||||
so the Auditor's approve_playbook/reject_playbook duty is discoverable."""
|
||||
auditor_id = uuid4()
|
||||
task_svc = AsyncMock()
|
||||
task_svc.agent_for.return_value = MagicMock(role="auditor", team="board")
|
||||
task_svc.list_long_running_blocked.return_value = []
|
||||
deps = _make_deps(task=task_svc)
|
||||
c = Choreographer(deps)
|
||||
|
||||
draft = MagicMock(id=uuid4(), title="Rebase onto a live rung before cutting")
|
||||
playbook_svc = AsyncMock()
|
||||
playbook_svc.list_drafts.return_value = [draft]
|
||||
with patch(
|
||||
"roboco.services.playbook.get_playbook_service", return_value=playbook_svc
|
||||
):
|
||||
env = await c.auditor_triage(auditor_id)
|
||||
body = env.as_dict()
|
||||
assert body["status"] == "draft"
|
||||
assert body["task_id"] is None
|
||||
assert str(draft.id)[:8] in body["next"]
|
||||
assert "approve_playbook" in body["next"]
|
||||
assert "reject_playbook" in body["next"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_auditor_triage_only_first_anomaly_surfaces() -> None:
|
||||
"""Auditor gets the most-stale blocked task; others wait until next call."""
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
from uuid import uuid4
|
||||
|
||||
@@ -9,7 +10,7 @@ import pytest
|
||||
from roboco.services.gateway.content_actions import ContentActions, ContentActionsDeps
|
||||
|
||||
|
||||
def _actions(role: str) -> ContentActions:
|
||||
def _actions(role: str, *, notification_delivery: Any = None) -> ContentActions:
|
||||
task = MagicMock()
|
||||
agent = MagicMock()
|
||||
agent.role = role
|
||||
@@ -22,6 +23,7 @@ def _actions(role: str) -> ContentActions:
|
||||
journal=MagicMock(),
|
||||
workspace=MagicMock(),
|
||||
notifications=MagicMock(),
|
||||
notification_delivery=notification_delivery,
|
||||
)
|
||||
return ContentActions(deps)
|
||||
|
||||
@@ -75,3 +77,54 @@ async def test_pitch_rejects_non_cell_target() -> None:
|
||||
target_cells=["board"],
|
||||
)
|
||||
assert env.error == "invalid_state"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pitch_notifies_ceo_on_success(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A successful pitch nudges the CEO via the notification-delivery seam."""
|
||||
created = MagicMock()
|
||||
created.id = uuid4()
|
||||
svc = MagicMock()
|
||||
svc.create = AsyncMock(return_value=created)
|
||||
monkeypatch.setattr("roboco.services.pitch.get_pitch_service", lambda _s: svc)
|
||||
notification_delivery = AsyncMock()
|
||||
env = await _actions(
|
||||
"product_owner", notification_delivery=notification_delivery
|
||||
).pitch(
|
||||
agent_id=uuid4(),
|
||||
title="Widget",
|
||||
slug="widget",
|
||||
problem="people need widgets",
|
||||
proposed_solution="build a widget service",
|
||||
target_cells=["backend", "frontend"],
|
||||
)
|
||||
assert env.error is None
|
||||
assert env.status == "proposed"
|
||||
notification_delivery.notify_ceo_of_pitch.assert_awaited_once_with(pitch=created)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pitch_survives_notification_failure(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""A CEO-notification failure never fails pitch() — best-effort only."""
|
||||
created = MagicMock()
|
||||
created.id = uuid4()
|
||||
svc = MagicMock()
|
||||
svc.create = AsyncMock(return_value=created)
|
||||
monkeypatch.setattr("roboco.services.pitch.get_pitch_service", lambda _s: svc)
|
||||
notification_delivery = AsyncMock()
|
||||
notification_delivery.notify_ceo_of_pitch.side_effect = RuntimeError("db down")
|
||||
env = await _actions(
|
||||
"product_owner", notification_delivery=notification_delivery
|
||||
).pitch(
|
||||
agent_id=uuid4(),
|
||||
title="Widget",
|
||||
slug="widget",
|
||||
problem="people need widgets",
|
||||
proposed_solution="build a widget service",
|
||||
target_cells=["backend", "frontend"],
|
||||
)
|
||||
assert env.error is None
|
||||
assert env.status == "proposed"
|
||||
notification_delivery.notify_ceo_of_pitch.assert_awaited_once()
|
||||
|
||||
Reference in New Issue
Block a user