Skip to content

Make Guardian V3 routing and retrieval guidance configurable - #62372

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/83b3fcd23c680e90d2b2aea82a4a290633729658
Nov 18, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/83b3fcd23c680e90d2b2aea82a4a290633729658

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Make Guardian V3 routing and retrieval guidance configurable

Why

Guardian V3 uses fixed guidance for grouping evidence into board channels
and deciding when to retrieve more evidence. Longer routing instructions
also leave less room for evidence in the model's context window.

What changed

Under features.guardianv3, add housekeeper.routing_instructions and
reviewer.retrieval_instructions to customize those strategies while
preserving the routing format and the reviewer's board and authorization
rules. Blank or omitted instructions use the built-in guidance.

Add an optional max_instruction_tokens cap that validates each custom
prompt separately using an estimated token count. Ignore both prompts and
the cap in project config. The housekeeper.batch_timeout_ms setting
controls the per-batch routing timeout and defaults to 90 seconds.

Size routing batches to fit the model's input window after accounting for
the prompt and response schema. Route the largest fitting prefix of whole
evidence records within the tool-output budget and leave the rest pending.

Testing

Cover prompt validation, project config filtering, feature toggle merging,
and default retrieval guidance. Exercise custom prompts in model requests
and verify that routing reduces a batch under context pressure or stops
without advancing the cursor when even one record cannot fit.

## Why

Guardian V3 uses fixed guidance for grouping evidence into board channels
and deciding when to retrieve more evidence. Longer routing instructions
also leave less room for evidence in the model's context window.

## What changed

Under `features.guardianv3`, add `housekeeper.routing_instructions` and
`reviewer.retrieval_instructions` to customize those strategies while
preserving the routing format and the reviewer's board and authorization
rules. Blank or omitted instructions use the built-in guidance.

Add an optional `max_instruction_tokens` cap that validates each custom
prompt separately using an estimated token count. Ignore both prompts and
the cap in project config. The `housekeeper.batch_timeout_ms` setting
controls the per-batch routing timeout and defaults to 90 seconds.

Size routing batches to fit the model's input window after accounting for
the prompt and response schema. Route the largest fitting prefix of whole
evidence records within the tool-output budget and leave the rest pending.

## Testing

Cover prompt validation, project config filtering, feature toggle merging,
and default retrieval guidance. Exercise custom prompts in model requests
and verify that routing reduces a batch under context pressure or stops
without advancing the cursor when even one record cannot fit.

GitOrigin-RevId: 83b3fcd23c680e90d2b2aea82a4a290633729658
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/83b3fcd23c680e90d2b2aea82a4a290633729658 branch from 74d6d3d to 8bbe7c7 Compare November 18, 2026 21:56
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-18T21:56:45.871040Z 74d6d3d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 8bbe7c7 into main Nov 18, 2026
11 of 24 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/83b3fcd23c680e90d2b2aea82a4a290633729658 branch November 18, 2026 21:56
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant