Skip to content

feat(battle_test): InlinePromptGate Slice 5b — SerpentFlow boot wire-up - #29868

Open
drussell23 wants to merge 3 commits into
mainfrom
ouroboros/inline-prompt-gate-5b
Open

feat(battle_test): InlinePromptGate Slice 5b — SerpentFlow boot wire-up#29868
drussell23 wants to merge 3 commits into
mainfrom
ouroboros/inline-prompt-gate-5b

Conversation

@drussell23

@drussell23 drussell23 commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wires the Slice 4 phase-boundary renderer into SerpentFlow production boot, closing the deferred integration gap from Slice 5.
  • Three minimal changes: one import, one __init__ call, one stop() unsub.
  • 384/384 tests green (test_inline_prompt_gate_* + test_inline_permission_*).

Changes

backend/core/ouroboros/battle_test/serpent_flow.py

# 1. Import (line 47)
from backend.core.ouroboros.governance.inline_prompt_gate_renderer import (
    attach_phase_boundary_renderer,
)

# 2. SerpentFlow.__init__ — after console construction (line 435)
self._unsub_inline_prompt_renderer = attach_phase_boundary_renderer(
    self.console.print
)

# 3. SerpentFlow.stop() — first line (line 570)
self._unsub_inline_prompt_renderer()

attach_phase_boundary_renderer is defensive (NEVER raises): if the controller singleton isn't available yet at boot, it returns a no-op unsub and logs a warning — so this can never block SerpentFlow construction.

Test Results

tests/governance/test_inline_prompt_gate_graduation.py   ........ 23 passed
tests/governance/test_inline_prompt_gate_http.py         ........ 39 passed
tests/governance/test_inline_prompt_gate_primitive.py    ........ 83 passed
tests/governance/test_inline_prompt_gate_renderer.py     ........ 39 passed
tests/governance/test_inline_prompt_gate_runner.py       ........ 34 passed
tests/governance/test_inline_permission_graduation.py    ........ 24 passed
tests/governance/test_inline_permission_memory.py        ........ 51 passed
tests/governance/test_inline_permission_observability.py ........ 33 passed
tests/governance/test_inline_permission_prompt.py        ........ 58 passed

384 passed, 2 warnings in 4.30s

Task 2 — Battle Test Findings (renderer validation)

Environment constraint: The sandbox has no ANTHROPIC_API_KEY or DOUBLEWORD_API_KEY, so ouroboros_battle_test.py exits at preflight with ERROR: No API keys set. A live battle soak with JARVIS_INLINE_PROMPT_GATE_ENABLED=true must be run interactively.

Renderer validated via controlled simulation — a synthetic NOTIFY_APPLY-tier phase-boundary request was registered against the controller singleton with a 50ms timeout (headless = no operator), then allowed to expire:

Phase-boundary prompts emitted : 2
Registration latency            : 0.1ms
Time to auto-EXPIRED            : ~200ms (50ms timeout + event propagation)

Operator-visible block format (OUTPUT[0] — pending):

  [Phase Boundary] op-confirmation pending
    summary  : Modify backend/voice/pipeline.py: improve wake-word detection threshold (NOTIFY_APPLY)
    target   : backend/voice/pipeline.py
    op       : op-voice-0a1b2c
    rule     : phase_boundary_inline_prompt
    timeout  : 0.1s
    prompt_id: pb-sim-001
    actions  : /allow   /deny <reason>   /pause

Dismiss line (OUTPUT[1] — auto-expired, headless):

  [Phase Boundary] expired: pb-sim-001 (reviewer=auto-timeout) reason=prompt_expired after 0s

Unexpected errors: None. The [Phase Boundary] sentinel correctly filters out per-tool-call prompts — the existing ConsoleInlineRenderer path was not double-fired in any simulation run.

Latency between prompt emission and auto-EXPIRED is determined entirely by timeout_s on the InlinePromptRequest (set by the phase-boundary producer in Slice 2). In headless production runs there is no operator present to /allow, so prompts always expire at timeout_s. The renderer fires the dismiss line synchronously in the controller's _fire path — no additional latency.

Test Plan

  • python3 -m pytest tests/governance/test_inline_prompt_gate_*.py tests/governance/test_inline_permission_*.py — 384/384 green
  • attach_phase_boundary_renderer / unsub lifecycle validated end-to-end in simulation
  • [Phase Boundary] block rendered correctly for pending + expired events
  • Per-tool-call prompts correctly filtered (sentinel check)
  • Live interactive battle soak with JARVIS_INLINE_PROMPT_GATE_ENABLED=true — requires API keys, must be run locally

https://claude.ai/code/session_01Sgackd9hS2XsiN6ziKgrLe


Generated by Claude Code


Summary by cubic

Wire the Slice 4 phase-boundary renderer into SerpentFlow boot so [Phase Boundary] prompts render in the operator console for NOTIFY_APPLY operations. Adds the renderer import, initializes it with self.console.print, and unsubscribes in stop(); the hook is defensive and returns a no-op if the controller isn’t ready.

Written for commit 67a2ff3. Summary will update on new commits.

drussell23 added 3 commits May 1, 2026 21:45
Activates the Slice 4 phase-boundary renderer in production by wiring
attach_phase_boundary_renderer(self.console.print) into SerpentFlow.__init__
immediately after console construction, with unsub called in stop().

The renderer now fires [Phase Boundary] blocks in the operator console for
every NOTIFY_APPLY-tier op the session generates — closing the deferred
integration gap from Slice 5.

384/384 tests green (test_inline_prompt_gate_* + test_inline_permission_*).
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

📊 PR Size Analysis

Size: XS
Files Changed: 1
Lines Added: +9
Lines Deleted: -0
Total Changes: 9

Review Checklist

  • All tests passing
  • Code follows project style guidelines
  • Documentation updated if needed
  • No sensitive data exposed
  • Breaking changes documented

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The Validate Configuration workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #29869

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The Environment Variable Validation workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #29870

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

🚨 CI/CD Failure Detected

The Database Connection Validation workflow failed for this PR.

Action Required

A tracking PR has been automatically created to help resolve this issue:
🔗 #29871

Quick Links

Please review the analysis and implement the suggested fixes.


🤖 Auto-generated by JARVIS CI/CD Manager

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

🤖 CI/CD Pipeline Results

Status: success
Branch: 29868/merge
Commit: cd733b604c34d94779708c60ae167bdd5daef6d2

Pipeline Stages

  • Code Quality: ❌
  • Build & Test: ❌
  • Architecture: ❌
  • Security Scan: ❌

View full workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant