feat(preflight): SessionEnd queue-drain integration + Flow 4b (#156 PR B)#202
Merged
Conversation
…assertion (#156 PR B) Closes the cross-flow correction-capture path opened by #156 PR A. Phase 1 — capture-corrections + preflight SKILL.md updates: - skills/bicameral-capture-corrections/SKILL.md: in-session mode gains Step 0 queue-drain. Bounded by the existing preflight ≤4-question cap (queue-drained ask-corrections + in-session ask-corrections ≤ 4 total). Files exceeding the cap stay pending for the next preflight. New telemetry fields g11_queue_drained / g11_queue_remaining / g11_queue_cap_hit quantify cap binding (signal for future UI surface). - skills/bicameral-preflight/SKILL.md: Step 3.5 description gains a forwarding paragraph noting the queue-drain. Canonical drain rubric remains in capture-corrections (single source of truth); preflight delegates via the in-session mode invocation. Phase 2 — Flow 4b cross-flow assertion + --flow filter: - tests/e2e/prompts/flow-4b-queue-drain.md: new prompt that drives a trivial code-implementation task without mentioning bicameral. The queue drain happens automatically through preflight's UserPromptSubmit hook firing capture-corrections in-session mode. - tests/e2e/run_e2e_flows.py: - assert_flow_4b: three filesystem + ledger assertions validating the SessionEnd-write → next-preflight-drain → ingest pipeline end-to-end. - _filter_flow_plan(plan, pattern): pure helper for substring-matching flow_id. Used by the new --flow PATTERN argparse argument on main(). - --flow argparse: enables targeted CI invocations. `--flow "Flow 4"` runs both Flow 4 + Flow 4b (cross-flow validation); `--flow "Flow 4b"` runs Flow 4b only (dev-velocity workflow). Exit 2 on no-match typos. - Flow 4 advisory text: replaced "deferred to PR B" placeholder with pointer to Flow 4b. - FlowSpec entry for Flow 4b: inherits session_group="dev_session" so the queue Flow 4 wrote is the queue Flow 4b drains. - tests/test_run_e2e_flows_filter.py: 3 functionality tests for the filter helper. Mirrors the import pattern from tests/test_e2e_asserters.py:30-42 (shutil.which stub for claude / bicameral-mcp binary lookups at run_e2e_flows import time). Tests: 3/3 filter tests pass; ruff/format clean; mypy clean on run_e2e_flows.py. argparse smoke-checked: typo-pattern correctly exits 2 with available-flows hint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<repo>/.bicameral/pending-transcripts/before scanning recent in-session turns.--flow PATTERNargparse filter ontests/e2e/run_e2e_flows.py:main()enables targeted CI invocations:--flow "Flow 4"runs Flow 4 + Flow 4b together (cross-flow validation),--flow "Flow 4b"runs Flow 4b only (dev-velocity workflow).Closes #156 fully (PR A shipped the queue-write; PR B closes the read/drain side).
Linked issues
Closes #156
Refs PR A: #198 (now merged on dev)
Phases
Phase 1 — capture-corrections + preflight SKILL.md updates
skills/bicameral-capture-corrections/SKILL.md: in-session mode "## Steps" gains Step 0 (queue drain with ≤4-cap and partial-archive rules). Telemetry section gainsg11_queue_drained/g11_queue_remaining/g11_queue_cap_hitdiagnostic counters.skills/bicameral-preflight/SKILL.md: Step 3.5 description gains a forwarding paragraph. Canonical drain rubric stays in capture-corrections (single source of truth).Phase 2 — Flow 4b cross-flow assertion +
--flowfiltertests/e2e/prompts/flow-4b-queue-drain.md: new prompt (trivial docstring add; no mention of bicameral / queue / corrections — the drain happens automatically via the preflight hook).tests/e2e/run_e2e_flows.py:assert_flow_4b: three assertions (pending-transcripts/ empty, processed-transcripts/ contains archived file, ledger has source=agent_session decision)._filter_flow_plan(plan, pattern): pure substring filter helper.--flow PATTERNargparse argument onmain(). Exit 2 on no-match typo with available-flows hint.FlowSpecfor Flow 4b inheritingsession_group="dev_session".tests/test_run_e2e_flows_filter.py: 3 functionality tests for_filter_flow_plan(no-pattern path, multi-match substring, exact match). Followstests/test_e2e_asserters.py:30-42shutil.whichstub precedent.Test plan
pytest tests/test_run_e2e_flows_filter.py -v— 3/3 filter tests passpytest tests/test_session_end_queue_writer.py tests/test_session_end_hook_drift.py tests/test_setup_wizard.py tests/test_e2e_asserters.py -v— 31/31 dependent tests still pass (PR A primitives, drift tests, e2e asserter unit tests)ruff check . && ruff format --check .— cleanmypy tests/e2e/run_e2e_flows.py— clean--flow "Flow 99 nonexistent"→ exit 2 withAvailable: [..., 'Flow 4b', ...]hintpython tests/e2e/run_e2e_flows.py --flow "Flow 4"validates the Flow 4 + Flow 4b cross-flow path end-to-end (deferred to CI environment withDESKTOP_REPO_PATHset)Notes for review
upstream/dev(post-feat(hooks): SessionEnd queue-write pivot per #156 #198, post-feat(#114): CI grounding lint — plan paths + PR-body refs #121)._validate_flow4_via_ledgerpattern — uses_snapshot_ledger()+_count_agent_session_decisions()already in the file."Flow 4"matches both Flow 4 and Flow 4b naturally, which is exactly the shape the cross-flow CI command needs (Flow 4b requires Flow 4 to populate the queue first via its SessionEnd hook). Narrow exact-match filtering uses--flow "Flow 4b".--flow "Flow 4b"CI command referenced an argument that didn't exist; F1 was resolved by adding the argparse arg as part of Phase 2).🤖 Generated with Claude Code