Skip to content

docs(plans): design decision-model support — qq-decision crate, OpenAI Decisions API and Jev (DM0) - #249

Closed
lg2m wants to merge 6 commits into
mainfrom
docs/eng-985-decision-architecture
Closed

lg2m wants to merge 6 commits into
mainfrom
docs/eng-985-decision-architecture

Conversation

@lg2m

@lg2m lg2m commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Refs ENG-985. Replaces the Jev planning documents; documentation only.

Result

Rebased on main 55936a1. Preserves accepted ADR0055, current indexes and later ledger entries. Removes docs/plans/jev.md and docs/plans/progress/jev.md; decision-models.md replaces each. No runtime/config/wire/schema changes or automatic activation.

Provider-neutral design separates transport (qq-provider), evidence/rubrics/calibration (qq-decision), and authoritative execution (qq-core). Research covers Jev, Cloudflare Clef and future APIs without guessing OpenAI's unpublished contract. Adds action-bound revalidation, deployment/evidence identity, honest legacy compatibility, shadow qualification and proposed immediate Off semantics. Useful PR319 ideas retained: requested versus returned model/request provenance and nullable-versus-malformed usage. PR319 conformance test weakness documented; contributor code not executed.

Verification

cargo xtask check

Head c708252 vs origin/main; 23 changed files; scope qq, xtask.

Gate Result Tests Time Command
fmt pass 1.5s cargo fmt --all -- --check
lint pass 1.9s cargo xtask lint
clippy pass 3.6s cargo clippy --color never -p qq -p xtask --all-targets --all-features -- -D warnings
test pass 395/395 passed, 2 skipped 41.1s cargo nextest run --color never --profile default -p qq -p xtask

All gates passed in 48.1s.

Docs-truth 24/24; 559 local Markdown links resolved; no conflict markers; diff check clean. Earlier affected run had two unchanged headless timeout failures; isolated rerun and final full affected gate passed. No live provider inference or paid evaluation. Independent source review clarified legacy authority and proposed Off semantics.

Stack and authority

Base: main. DM1 implementation will target this docs branch. Owner explicitly requested publication and beginning task 1 on 2026-10-16. That authorizes bounded DM1 foundation, not paid evaluation, broader authority or default-on behavior.

@lg2m

lg2m commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Reopens #231, which was merged without approval and reverted in #246.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T06:42:07.096642Z 303b01c New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69dc3fd89e

ℹ️ 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".

Comment thread docs/design/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/progress/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
lg2m added a commit that referenced this pull request Oct 5, 2026
…act record (CX0+CX1) (#239)

* docs(plans): plan fast, exact, cache-aligned compaction; ADR-0055 (CX0)

Plan docs/plans/compaction.md (CX0-CX5), ledger with the live-store
baseline (110-390 s per compaction, cold cache), and Proposed ADR-0055:
the summarizer writes a short narrative and QQ renders the exact record
from stored rows. Reserves ADR-0055 in progress/root.md (0054 is taken by

Refs: ENG-992, ENG-993

* perf(runtime): compaction writes a short narrative; QQ renders the exact record (CX1)

The summarizer now writes five short sections (Intent; Decisions and
constraints; Work state; Open problems; Next step) instead of retyping
user messages, errors and file lists. At commit, in the same transaction,
QQ renders a bounded record from stored rows and stores it after the
narrative: every user message and applied steering verbatim (older
prompts listed by ordinal for search_history), the last reply, files
modified and read, and failed calls. The record is rebuilt from rows at
every compaction, so it stays exact across any number of folds.

- Between runs, shrinkage is required of the narrative; the record is a
  bounded cost, so a stored six-section summary always folds into the
  new format. In-run steps count the record too.
- The summarizer uses the run's resolved output cap, held to an eighth of
  a declared window (never below 8 192), instead of a fixed 8 192 clamp.
- The in-run commit returns the stored text, so the live splice and
  replay render the same bytes.
- No schema or protocol change.

Refs: ENG-992, ENG-994

* docs(plans): link CX0/CX1 ledger rows to #239

* docs(plans): keep ADR-0056 after the #246 revert; hold 0055 for #249

* docs(runtime): cite ADR-0056 in compaction code comments and tools.md
@lg2m
lg2m force-pushed the docs/eng-985-decision-architecture branch from d0f9ad8 to c708252 Compare October 16, 2026 00:34

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7082522a0

ℹ️ 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".

Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
@lg2m

lg2m commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Published rebased docs head c708252; final affected gate passed 395/395 (2 skipped). Old docs/plans/jev.md and progress/jev.md are deleted and replaced by decision-models.md. DM1 implementation is stacked as #324, targeting this docs branch; #249 continues to target main. Merge docs first, then rebase/retarget #324. No runtime activation or paid inference in either change.

@lg2m
lg2m added this pull request to stack #326 October 16, 2026 01:21

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 344068b4f6

ℹ️ 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".

Comment thread src/runtime/jev.rs Resolved
Comment thread crates/qq-protocol/src/sessions.rs Resolved
Comment thread scripts/check-jev-contract-sync.sh Resolved
Comment thread src/runtime.rs Resolved
Comment thread src/advisory.rs Resolved
Comment thread src/runtime/jev.rs Resolved
Comment thread src/runtime/jev.rs Resolved
Comment thread src/runtime.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9ad2380a7

ℹ️ 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".

Comment thread docs/plans/decision-models.md Resolved
Comment thread docs/plans/decision-models.md Resolved
@lg2m

lg2m commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review — latest 7ea8e54 addresses both new findings: explicit DM6 naming prerequisite and DM4 shadow-only interpretation with separately gated authority activation. Please review latest head.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ea8e540e2

ℹ️ 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".

Comment thread docs/plans/decision-models.md Outdated
Comment on lines +237 to +239
- Activation after DM7 is a separate reviewed policy identity/calibration
change with paired legacy/new negative and fallback fixtures; DM7 installs
the gate and does not itself activate the broader parser.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require qualification before activating the broader parser

When DM7 has landed, this newly added clause treats an ordinary reviewed policy/calibration change as sufficient to activate answers that the legacy parser rejected. That still omits this plan's own A7/A13 qualification requirement and the explicit owner acceptance required before altering legacy Jev behavior at lines 1003–1006 and 1088–1096. This activation clause is fresh evidence beyond the prior shadow-only finding; name an activation slice gated on owner acceptance and A7/A13, or state that this plan does not authorize activation.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

Comment thread docs/plans/decision-models.md Outdated
Comment on lines +235 to +236
but accepted by new intervals: shadow receipt exists, held action never
settles from that reply. Legacy compatibility cannot grandfather this change.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move receipt proof to the receipt-owning slice

When DM4 runs after DM3, it owns only the validator, while JV6 owns the receipt builder and JV7 owns the shadow consumer; both are downstream, and JV6 itself depends on DM4. Requiring a shadow receipt here therefore cannot be demonstrated within DM4's inputs and owned paths, which risks merging the authority-sensitive interpretation change without the promised regression. Have DM4 assert a shadow/non-settling validator disposition and move the durable receipt assertion to JV6/JV7, or reorder the slices.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

Comment thread docs/plans/decision-models.md Outdated
| DM2c | Cloudflare Clef hosted transport/envelope, credential audience and non-truncating admission proof; shared System One codec | DM2 | `crates/qq-provider/src/providers{,/cloudflare_decisions}.rs`, compiler recipe, `qq-auth` audience; loopback fixtures | D2c; shadow comparison after DM7/JV7, paid runs only with approved spend |
| DM3 | Move the rubrics, parsers and thresholds of routing, approval and checkpoint into `qq-decision` consumers, **behavior-identical** (same requests, same dispositions, same policy identities) | DM2 | `crates/qq-decision/**`, `src/runtime*.rs`, `src/advisory.rs` | D3 |
| DM4 | Receipt-ready interpretation: raw distribution kept, QQ-computed confidence, vendor confidence side by side; JV3 precision parsed/recorded in shadow, never broadens authority | DM3 | `qq-decision` validator | A3 + D4 |
| DM5 | OpenAI Decisions adapter from the **published** contract, with fixtures copied from it; capabilities declared; `openai/default` credential audience | DM1, OpenAI API reference published | `crates/qq-provider/src/providers.rs`, `crates/qq-provider/src/providers/openai_decisions.rs`, `qq-auth` audience only | D5 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require bounded admission in the OpenAI slice

When OpenAI publishes its contract, DM5 can start directly from DM1, before DM2 adds the shared admission registry, and D5 tests only schema, capabilities, credentials, and offline fixtures. The OpenAI adapter can therefore satisfy all declared acceptance while omitting the 8-in-flight/32-pending bound, queue deadline, cancellation recovery, backpressure, and uncertain-send retry rules required for every decision request in §5.4. Fresh evidence beyond the repaired D2 admission finding is this separate DM5 dependency path; make DM5 depend on DM2 and run the common admission suite against OpenAI handles, or place the bounded transport in DM1.

AGENTS.md reference: AGENTS.md:L92-L93

Useful? React with 👍 / 👎.

Comment thread docs/plans/decision-models.md Outdated
Comment on lines +219 to +220
- After DM7/JV7, paired shadow comparison uses identical evidence with Jev;
no authority or quality claim follows from API compatibility.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Separate the deferred Clef comparison from DM2c

When DM2 completes, the task index makes DM2c startable, but this acceptance item cannot run until DM7 and JV7, which themselves require the later DM4/JV6 chain. The supposedly PR-sized DM2c slice must therefore either remain open across several downstream slices or be marked complete without demonstrating all of D2c. The concrete D2c row is fresh evidence beyond the earlier missing-ownership finding; move the comparison to a later slice or add DM7/JV7 as explicit inputs.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 303b01c7f4

ℹ️ 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".

Comment on lines +1107 to +1108
Extend A5/A8 to cover steering/revocation races, injection in evidence,
symlink/file changes after judgment, duplicate and late replies, and partial

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add stale-action revalidation to formal acceptance

When a task, edit target, symlink, or other workspace precondition changes after inference but before execution, the safety contract requires the authority result to become stale; however, this paragraph merely says to extend A5/A8 while neither acceptance section actually requires those cases, and JV8 does not own the executor path. An implementation can therefore satisfy every formal slice gate while executing an action justified by obsolete evidence. Add explicit atomic-revalidation race tests to A5/A8 and assign the required core execution paths to the implementing slice.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

| JV5 | Durable hold lifecycle ([ADR-0047](../adr/0047-jev-approval-hold-lifecycle.md), finding 3) | JV2 | `qq-core/src/sessions/approvals.rs`, tool-call persistence, `qq-protocol`, `qq-client`, `qq-tui`, `src/headless.rs` | A5 |
| JV6 | Per-attempt receipts and pre-dispatch spend admission (finding 7), using `DecisionError`'s dispatch split | JV5, DM4 | Approval gate, core budget, session store, protocol accounting, `qq-decision` receipt builder | A6 |
| JV7 | Shadow calibration | JV4, JV6, DM7 | `qq-decision` shadow consumer, evaluation projection | A7 |
| JV8 | Layered approval pilot: effect classes, narrow parallel questions, per-turn batching (findings 1, 7) | JV7, owner scope decision | Approval consumer and composition, pilot fixtures | A8 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Give JV8 a batch-capable core approval seam

When one model turn contains multiple held calls, JV8 cannot meet A8's single batched-request requirement within these owned paths: the existing ReviewRequest represents one call and carries no turn identifier or batch boundary, while ApprovalReviewer::review receives requests individually (crates/qq-core/src/sessions/runtime.rs:480-501,600-601). A consumer cannot reliably determine which calls belong together or when the turn's batch is complete. Include the relevant qq-core approval seam in JV8 and define a typed per-turn batch contract, or drop the batching acceptance requirement.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

Comment on lines +267 to +268
- `QQ_DECISIONS=off` beats every profile, and a stored key plus a
configured model enable nothing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent child profiles from adding decision authority

When a parent plan has no decision consumer or lacks a particular model but an owned child resolves a profile that enables one, the listed D6 cases can all pass even though the child gains inference egress and potentially approval authority forbidden by the plan's owned-child invariant. Add configuration/plan-compilation tests proving that children may only retain or narrow the parent's consumer and model set, including profile changes and routed reloads.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

| JV7 | Shadow calibration | JV4, JV6, DM7 | `qq-decision` shadow consumer, evaluation projection | A7 |
| JV8 | Layered approval pilot: effect classes, narrow parallel questions, per-turn batching (findings 1, 7) | JV7, owner scope decision | Approval consumer and composition, pilot fixtures | A8 |
| JV9 | `/decisions` panel (was `/jev`), explained preset, one server-side Off | JV1a, JV6, DM6 | `qq-tui`, `qq-client`, `qq-protocol` session command; `qq-server`, `qq-core/src/sessions/{approvals,commands,runtime,tool_calls}.rs`, composition and `qq-decision` admission/epoch checks | A9; immediate Off requires owner acceptance |
| JV10 | Routing by adequacy (finding 8) | JV3, JV6 | Routing consumer, candidate metadata | A10 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate JV10 routing changes on calibration

When existing jev_routing is enabled, this dependency path lets JV10 ship the new routing.v2 adequacy rubric after JV3/JV6 but before DM7 or JV7 installs the calibration and shadow-only gate. A10's offline/performance comparison does not require a calibration row, so the unqualified rubric can automatically select a model despite the plan-wide rule that an uncalibrated provider/model/rubric/effect key may only shadow. Fresh evidence beyond the repaired DM6 path is this independent legacy-routing activation path; make JV10 depend on DM7/JV7 or split it into shadow evaluation and separately qualified activation.

AGENTS.md reference: AGENTS.md:L203-L204

Useful? React with 👍 / 👎.

@lg2m lg2m closed this Oct 19, 2026
@lg2m
lg2m deleted the docs/eng-985-decision-architecture branch October 19, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant