Close relation campaign and structural debt - #12
Conversation
|
Important Review skippedToo many files! This PR contains 160 files, which is 110 over the limit of 50. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (161)
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9efc5dc19f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let already_complete = | ||
| campaign_start == CampaignStart::AlreadyComplete && rejudge_pair.is_none(); | ||
| let candidate_cursor = match campaign_start { | ||
| CampaignStart::AlreadyComplete => CandidateCursor::start(), |
There was a problem hiding this comment.
Keep rejudge from reopening complete campaigns
When rejudge_pair is requested for a campaign that is already Complete, already_complete is forced false but this branch restarts normal campaign paging from cursor 0. On any workspace whose total candidate space exceeds max_candidate_pairs, the rejudge succeeds and then publishes a new Partial checkpoint, making the latest durable campaign partial and causing strict compile/context calls to fail until the whole campaign is replayed.
Useful? React with 👍 / 👎.
| #[serde(default)] | ||
| strict_settlement: bool, |
There was a problem hiding this comment.
Default compile to the settlement gate
When an existing or direct texo.compile.run caller omits strict_settlement, this default makes it false, so the handler skips require_complete_settlement. In workspaces with no checkpoint, a partial checkpoint, or a stale complete checkpoint, compile can still write public artifacts and append OnboardingCompiledV2, bypassing the closed-campaign gate added by this change.
Useful? React with 👍 / 👎.
| #[serde(default)] | ||
| strict_settlement: bool, |
There was a problem hiding this comment.
Default agent context to the settlement gate
Callers that omit strict_settlement still get false here; the MCP get_agent_context adapter is one such path because it only sends subject and include_stale. That lets agent context expose current claims before an absent, partial, or stale relation campaign has settled supersession/conflict authority, even though strict settlement is the new gate for authority-bearing context.
Useful? React with 👍 / 👎.
9efc5dc to
e750943
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e750943967
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| freshness: view.freshness, | ||
| claims_total: view.claims.len(), | ||
| open_conflicts: view.conflicts.iter().filter(|card| card.phase == 1).count(), | ||
| settlement_complete: unresolved_pairs == 0, |
There was a problem hiding this comment.
Report incomplete until durable campaign completes
When a workspace has no matching RelationCampaignCheckpointV1 or only a pagination Partial checkpoint with no failed pairs, authoritative_settlements still yields unresolved_pairs == 0, so texo.workspace.status reports settlement_complete: true. Default texo.context.agent and texo.compile.run now call require_complete_settlement and will reject those same frontiers, so MCP/CLI users can be told settlement is complete immediately before authority-bearing calls fail; this flag needs to include the same complete-checkpoint test as the gate.
Useful? React with 👍 / 👎.
| let mut output = empty_relate_output(prepared.claims.len(), prepared.candidate_pair_budget); | ||
| output.receipts = take_receipts()?; | ||
| return Ok(output); | ||
| } |
There was a problem hiding this comment.
Reject rejudge before the trivial campaign shortcut
When rejudge_pair is supplied but fewer than two claims are currently eligible (for example, the authoritative pair was later superseded or put in conflict), this shortcut returns a successful complete campaign before rejudge_authoritative_pair runs. The requested cache eviction and fresh judgment are silently skipped and rejudged_pair stays null, so the command should either process the rejudge first or return an input error instead of taking the trivial-complete path.
Useful? React with 👍 / 👎.
e750943 to
a439df2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a439df2872
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let key = IdempotencyKey::for_operation( | ||
| "texo.relation.campaign.checkpoint.v1", |
There was a problem hiding this comment.
Allow complete checkpoints to supersede later partials
When a workspace already has an older matching Complete checkpoint and then gets a later Partial checkpoint for the same basis/policy, a successful resume attempts to append the same complete checkpoint identity used by the old event. Because this idempotency key is independent of journal position, BatPak returns the old complete receipt instead of writing a new checkpoint after the partial, so latest_checkpoint still sees the partial and strict compile/context remain stuck. Fresh evidence is that the checkpoint backend now deduplicates complete checkpoints by phase/digests, even though the relation gate depends on the latest checkpoint in commit order.
Useful? React with 👍 / 👎.
a439df2 to
795f095
Compare
There was a problem hiding this comment.
💡 Codex Review
Line 283 in 795f095
When texo.agent.session.end has a relate model configured, run_session_relate calls run_relate_pass, and the new relation campaign flow appends a RelationCampaignCheckpointV1 (evt.e012) for trivial, partial, and complete runs. Because this operation descriptor still omits evt.e012, the host manifest under-declares a write that happens on every session-end relate pass with a model key.
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| input_schema = "texo.relate.run.input.v2", | ||
| output_schema = "texo.relate.run.output.v2", | ||
| receipt_kind = "receipt.texo.relate.run.v2", | ||
| appends_events = ["evt.e003", "evt.e004", "evt.e009", "evt.e010", "evt.e012"], |
There was a problem hiding this comment.
Declare the actual deferral event kind
When a relate page records unresolved pairs, append_relation_deferrals appends RelationDeferredV1; that payload is type_id 10 and is advertised elsewhere as evt.e00a, not evt.e010. This descriptor now omits the real deferral event and claims an unrelated event kind, so the host/module manifest and ops catalog under-declare partial/failure-page writes and over-declare an event this operation does not append.
Useful? React with 👍 / 👎.
| output_schema = "texo.relate.run.output.v2", | ||
| receipt_kind = "receipt.texo.relate.run.v2", | ||
| appends_events = ["evt.e003", "evt.e004", "evt.e009", "evt.e010", "evt.e012"], | ||
| queries_projections = ["texo.workspace.view.v2"] |
There was a problem hiding this comment.
Restore model-capability admission for relate
For environments without a model key, the host only grants texo.cap.model when grants_model_capability sees a non-empty key, and other model-backed operations still require that capability. This descriptor dropped the requirement for texo.relate.run, so texo relate is admitted without a model capability and fails later in the OpenRouter backend instead of through the central fail-closed admission path (op.denied/503-style behavior).
Useful? React with 👍 / 👎.
795f095 to
072d1ae
Compare
072d1ae to
3013b5b
Compare
What changed
--allow-unsettledfor the offline heuristic demo path.texo.cap.modelat host admission, with descriptor and no-capability regression tests.Root causes
Candidate enumeration previously had no hard global page boundary, relation progress was not represented as durable campaign state, and output/status paths inferred completion from incomplete proxies. Large mixed-concern modules also hid state and control-flow boundaries, while lint suppressions allowed structural debt to accumulate.
User and operator impact
texo relatenow reports page budget and resume cursor in human and JSON output, completed campaigns are durable no-ops, and suspect verdicts can be explicitly rejudged without reopening a settled campaign. Workspace status and knowledge triangulation now agree with default compile/context about whether settlement is complete. Default compile and agent-context calls reject absent, partial, or stale campaign state. The offline heuristic demo and startup hook use a conspicuousallow_unsettledopt-out where incomplete semantic settlement is intentional.Validation
cargo check --all-targetscargo clippy --all-targets -- -D warningscargo deny check— advisories, bans, licenses, and sources all clean with no warningsjust verify— 296 unit tests plus all integration, compile-fail, and doc tests passedjust test-invariants— projection laws, compile-fail laws, and BatPak-family spikes passedjust demo-freshgenerated all six artifacts;texo verify --jsonreported zero errors with journal/projection/transitions all trueTEXO_LLM_API_KEYCloses #1
Closes #3
Closes #5
Closes #6
Closes #7
Closes #8
Greptile Summary
This PR adds durable, resumable relation campaigns and makes semantic settlement the default for authority-bearing output. The main changes are:
--allow-unsettledopt-outs for offline demo paths.Confidence Score: 5/5
This looks safe to merge.
The compile and agent-context gates now default to requiring complete settlement. Callers must explicitly opt out with
allow_unsettled. No blocking issues were found in the updated settlement paths.What T-Rex did
Important Files Changed
allow_unsettled.Reviews (6): Last reviewed commit: "close relation campaign and structural d..." | Re-trigger Greptile