feat(fleet): opus-fable adoption — doctrine + discipline hooks (v0.18.0 A)

Fleet behaves more like Fable 5 on existing model tiers, behind
ROBOCO_FABLE_MODE_ENABLED (config default off; armed :-true on the NAS compose,
absent from the registry compose).

- Doctrine: vendored agents/prompts/doctrine/fable.md composed into every
  agent's system prompt via fable_doctrine_layer() after base.md.
- Hooks (Claude Code): 4 non-overlapping hooks (stop-gate/bash-discipline/
  honesty-nudge/precompact) appended per-agent via _fable_hook_groups(). The
  make-quality + lint-suppression duplicates are deliberately NOT added (already
  gate-enforced); session-start skipped.
- Hooks (grok): conservative V1 — only the non-denying honesty-nudge, since a
  grok hook deny cancels the whole run.
- Flag on the feature-flags card; hook scripts shipped into the agent image.

Flag-off spawn path proven byte-identical (worktree diff, sha256 match); full
suite green (2074 unit + e2e-smoke + hook harness), mypy/xenon/ruff clean.
Fixed a real stdin bug in the vendored stop-gate hook (heredoc + pipe both
claimed stdin). Distilled from rennf93/opus-fable-playbook (MIT).
This commit is contained in:
Renn F
2026-07-04 06:44:40 +02:00
parent 30289333da
commit 7716830322
24 changed files with 881 additions and 5 deletions
+42
View File
@@ -10,6 +10,7 @@ envelope prints verbatim so a seam regression names itself.
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import patch
from tests.e2e_smoke.arcs import (
dev_arc,
@@ -55,3 +56,44 @@ def test_leaf_dev_task_reaches_pm_review(e2e_stack: E2EStack) -> None:
final = task_state(stack, task_id)
assert final["status"] == "awaiting_pm_review", final
assert final["docs_complete"] is True, final
def test_leaf_dev_task_reaches_pm_review_with_fable_mode_on(
e2e_stack: E2EStack,
) -> None:
"""Non-interference regression check for fable_mode_enabled=True.
This harness cannot exercise compose_prompt / _generate_agent_settings —
those live entirely in the orchestrator's spawn-prep path, which the
harness bypasses by design (see tests/integration/test_fable_mode_spawn_prep.py
for that half). What it CAN prove is that arming the flag doesn't perturb
the gateway/lifecycle arc itself: the same scenario must reach the same
outcome with the flag on as with it off.
"""
with patch("roboco.config.settings.fable_mode_enabled", True):
stack = e2e_stack
company = seed_company(stack)
project_id, project_slug = seed_project(stack, company)
task_id = seed_task(
stack,
title="Add the greeting module (fable-mode non-interference check)",
description=(
"Create greeting.txt with a friendly greeting so the smoke "
"harness has a real file change to commit, push, and merge."
),
acceptance_criteria=[
"greeting.txt exists at the repo root",
"its content greets the reader",
],
project_id=project_id,
created_by=company.cell_pm_id,
assigned_to=company.dev_id,
)
dev_arc(stack, company, project_slug, task_id)
qa_arc(stack, company, task_id)
doc_arc(stack, company, task_id, filename="greeting.txt")
final = task_state(stack, task_id)
assert final["status"] == "awaiting_pm_review", final
assert final["docs_complete"] is True, final