WS-POL-003-02: add unified project guide agent adapter - #301
Conversation
📝 WalkthroughWalkthroughThe PR adds unified project-guide compilation to the project-agent runtime. It introduces canonical context serialization, strict structured output, prompt-size enforcement, disabled tracing, result validation, lifecycle tests, and updated rollout evidence. ChangesProject-guide compilation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant Runtime
participant OpenAI SDK
participant Result Validator
Caller->>Runtime: compile_project_guide(context)
Runtime->>OpenAI SDK: Send canonical context with strict schema
OpenAI SDK-->>Runtime: Return structured output
Runtime->>Result Validator: Validate compilation result
Result Validator-->>Caller: Return validated result
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
@.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-02-unified-agent-adapter.md:
- Around line 14-19: Update the allowed-file list in the chunk contract to
include the changed CHUNK_MAP.md file and each exact changed initiative record
path; replace the broad “review/trust evidence under” directory entry with
explicit paths. Ensure the allowlist exactly matches the PR’s changed files, or
remove any change not covered by it.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6a91c75b-c919-464a-a48b-6b3770f6ef69
📒 Files selected for processing (8)
.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/CHUNK_MAP.md.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/STATUS.md.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-02-unified-agent-adapter.md.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/reviews/WS-POL-003-02-internal-review-evidence.md.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/reviews/WS-POL-003-02-pr-trust-bundle.mdbackend/app/adapters/project_agents/openai_agent_sdk.pybackend/app/interfaces/project_agents.pybackend/tests/test_agent_runtime.py
Chunk
WS-POL-003-02— Unified project-guide agent adapter.Goal
Add one hidden
compile_project_guideruntime method that sends the merged strict context through exactly one provider call and validates the complete untrusted result before returning.Intent And Planning Context
.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/PLAN.md.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-02-unified-agent-adapter.mdWhat Changed
compile_project_guideto the existing project-agent runtime port and OpenAI adapter.Why It Changed
The unified guide compiler needs one bounded model attempt over the exact immutable guide and canonical capability projections. This adapter establishes that hidden provider boundary without wiring it into production orchestration.
Design Chosen
Reuse the existing runtime port, OpenAI adapter, and structured-run helper. The unified method opts into strict JSON schema, the dedicated envelope cap, tracing-disabled
RunConfig, and the merged trusted validator. Canonical guide JSON is parsed into the outer prompt envelope rather than double-encoded as a JSON string.Alternatives Rejected
Scope Control
Allowed Files Changed
Files Outside Stated Scope
Product Behavior
No database, migration, authorization, Celery, API, service orchestration, policy persistence/approval, catalogue, checker runtime, dependency, composition-root, or production caller change exists.
Evidence
Commands Run
Result Summary
Acceptance Criteria Proof
Runner.runcall consumes the canonical context.Test Delta
Tests Added
backend/tests/test_agent_runtime.py.Tests Modified
Tests Removed Or Skipped
Internal Reviewer Results
External Review
aa975ea6and preserved on integrated head7f12bd25; zero unresolved threads on exact head.7f12bd25f063840531a5f19863977e57b36efcaf.CI And Gate Integrity
Remaining Risks
The method is intentionally hidden. Later persistence/orchestration chunks must preserve one logical attempt and must not enable tracing, tools, or a second inference path. Future catalogue growth must remain inside the complete-envelope cap.
Follow-Up Work
After human merge,
WS-POL-003-03Ais the next proposed candidate and requires a separately expanded executable contract and explicit start.Human Review Focus
Inspect canonical prompt fidelity, no-trace/no-tools boundaries, exact validator use, envelope accounting, cancellation/error semantics, and absence of production rewiring.
Human Merge Ownership
Summary by CodeRabbit