mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(gateway): journal task_id auto-injection works from blocked/paused
Smoke-5 root cause. Agents wrote 5 decisions / 8 reflections / 1 struggle
during the run — every single entry persisted with task_id=NULL. The C8
tracing gate then never saw them and PMs spiraled forever on
'missing: journal:decision' while their decisions sat orphaned.
Cause: ContentActions.note/say/dm/notify called
TaskService.get_active_task_for_agent for task_id auto-injection. That
helper filters to _DEV_ACTIVE_STATUSES = {claimed, in_progress,
verifying, awaiting_qa, awaiting_documentation}. BLOCKED, PAUSED, and
NEEDS_REVISION fall outside that set — so the moment an agent gets
stuck (which is exactly when they journal), auto-injection returns None
and the entry persists without task_id.
Fix:
- New TaskService.get_journal_context_task_for_agent — same shape as
get_active_task_for_agent but the status set
_JOURNAL_CONTEXT_STATUSES adds BLOCKED, PAUSED, NEEDS_REVISION.
- ContentActions.note/say/dm/notify use the new lookup.
- ContentActions.commit keeps the narrow get_active_task_for_agent —
can't commit from blocked, so the dev-active set is correct there.
Tests:
- tests/unit/services/test_journal_context_lookup.py — 5 tests pinning
the two queries: journal-context INCLUDES blocked/paused/needs_revision,
dev-active EXCLUDES them.
- Existing content-actions tests updated to stub the new method
alongside the old one.
This alone may be 70% of what was killing smoke runs end-to-end.
This commit is contained in:
@@ -26,6 +26,7 @@ def _make_deps(**overrides: AsyncMock) -> ContentActionsDeps:
|
||||
task = AsyncMock()
|
||||
task.agent_for.return_value = MagicMock(role="developer", slug="be-dev-1")
|
||||
task.get_active_task_for_agent.return_value = None
|
||||
task.get_journal_context_task_for_agent.return_value = None
|
||||
|
||||
git = overrides.get("git", AsyncMock())
|
||||
messaging = overrides.get("messaging", AsyncMock())
|
||||
@@ -68,6 +69,7 @@ async def test_say_posted_status_with_active_task() -> None:
|
||||
task_svc = AsyncMock()
|
||||
task_svc.agent_for.return_value = MagicMock(role="developer", slug="be-dev-1")
|
||||
task_svc.get_active_task_for_agent.return_value = task_obj
|
||||
task_svc.get_journal_context_task_for_agent.return_value = task_obj
|
||||
|
||||
ca = ContentActions(_make_deps(task=task_svc))
|
||||
env = await ca.say(
|
||||
|
||||
Reference in New Issue
Block a user