Skip to content

feat(obligations)!: add reviewed retire disposition for generated obligations - #9307

Open
BaaRai wants to merge 15 commits into
morluto:mainfrom
BaaRai:feat/obligation-disposition
Open

BaaRai wants to merge 15 commits into
morluto:mainfrom
BaaRai:feat/obligation-disposition

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reconstruction obligation ledgers could be closed without proof. A reviewed
reviewed_obligations record that named a generated obligation and retired it
cleared that obligation's required flag, so an agent facing a flood of
generated candidates could mark every one out-of-scope and reach a ready
ledger with no runtime authority, fixture, or verifier. This PR makes a
reviewed retirement an explicit, reasoned review of the generated claim that
never closes the ledger on its own, and adds an artifact-level
obligation-overgeneration limitation so a static-only candidate flood is
reported instead of silently demanding fixture work.

No issue is linked. The problem was found while exercising the ledger builder
with the BLA red-team harness (https://github.com/qybaihe/bla), which
produces Electron-style artifacts whose preload scripts expose many
context-bridge boundaries in unreachable code; the ledger generated an
obligation for each one and accepted blanket retirement as closure. The
findings are summarized here rather than in a separate issue; I can open one
if maintainers prefer tracking it that way.

Draft: not ready for review until the Linux CI lane is green.

Problem and expected behavior

Trigger: build a ledger for an artifact whose Application Graph yields many
generated obligations with no runtime authority, then supply reviewed records
that name those generated IDs with disposition: "out-of-scope".

Violated invariants on the base revision:

  • A reviewed record naming a generated ID competed with it
    (duplicate-definition) instead of reviewing it, and its own required
    value replaced the generated one, so required: false retired the claim
    from required_open.
  • Nothing recorded why a claim was retired; out-of-scope needed no reason.
  • Retiring every generated claim produced status: "ready" with zero proof:
    self-certification.
  • Nothing bounded a static-only candidate flood; the ledger asked for several
    fixtures and a verifier per decoy.

Expected: a retirement states its reason, keeps the generated definition
(including required), and a ledger reaches ready only through runtime
authority or manifest bindings for the artifact, never through retirement.

Change and scope

  1. Caller input contract (breaking for callers only). A
    reviewed_obligations record whose disposition is out-of-scope or the
    new not-applicable must carry a non-blank disposition_reason; it is
    rejected as caller input otherwise. This is a caller-input change only:
    the retained ledger output and stored Evidence use the separate
    ReconstructionObligation schema and are unaffected.
  2. not-applicable disposition. Added as an intentional second retiring
    disposition beyond the original ask, with a matching not-applicable
    diagnostic code that mirrors the existing out-of-scope diagnostic, so a
    reviewer can distinguish "outside this reconstruction's scope" from "this
    boundary cannot be reached".
  3. Retirement never makes a ledger ready. When a reviewed record retires
    a generated obligation, the generated definition is kept and only the
    disposition and reason are overlaid (addCandidate in
    src/application/ReconstructionObligationCandidates.ts). A retired
    required obligation still counts toward required_open. A fully retired
    artifact stays flagged by the over-generation limitation until runtime
    authority or manifest bindings exist for it. This is the intended defence
    against self-certification.
  4. Status. Any limitation forces ledger status unknown
    (reconstructionObligationLedgerStatus), so an over-generated ledger reads
    unknown even when every obligation is retired. That is the fail-closed
    choice; the design discussion may revisit whether a fully reviewed
    over-generated artifact should read open instead.
  5. obligation-overgeneration limitation. When more than
    OBLIGATION_OVERGENERATION_THRESHOLD (20) generated obligations in one
    artifact have neither runtime authority nor a manifest binding, the ledger
    adds one limitation for that artifact naming the count, families, and how
    many are still unreviewed versus retired. Every candidate is still emitted;
    nothing is dropped or capped. The threshold is a documented constant in
    src/application/ReconstructionObligationLedgerEvaluation.ts and may need
    tuning against real applications.

Not included: no change to manifest bindings, proof evaluation, closure
digests, or the MCP tool surface; no new runtime setting for the threshold.

Contract and boundary impact

  • Semantic owner and earliest changed stage:
    src/domain/reconstructionObligationLedgerSchemas.ts parses the reviewed
    record (now a discriminated union on disposition);
    src/application/ReconstructionObligationCandidates.ts merges a retiring
    reviewed record into the generated candidate;
    src/application/ReconstructionObligationLedgerEvaluation.ts emits the
    not-applicable diagnostic and the over-generation limitation. No
    superseded path removed.
  • Contribution scope fit and linked maintainer decision: evidence-reporting
    change within existing boundaries; no target execution, injection,
    mutation, or protection recovery. Scope decision: not applicable (pending
    maintainer confirmation while draft).
  • CLI and MCP/tool-catalog contract: build_reconstruction_obligation_ledger
    input tightens (disposition_reason required for retiring dispositions;
    not-applicable accepted). Output schema gains the not-applicable
    diagnostic code and the obligation-overgeneration: limitation text.
    MCP boundary tests pass (see validation).
  • The break is caller-input only: disposition_reason is required for the retiring dispositions in reconstructionObligationLedgerInputSchema; retained ledger Evidence still parses because the output obligations use a separate schema.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: retained
    ReconstructionObligation records and stored Evidence are unchanged in
    shape; disposition_reason is carried into the out-of-scope /
    not-applicable diagnostic detail.
  • Target selection, authority, upstream behavior, and cleanup details: not
    applicable.
  • Generated metadata, package, or installation impact: npm run docs:check
    passes on this branch; no committed generated outputs.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data. (unchanged: the ledger reads the
    caller-supplied Evidence bundle and manifest)
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/application/ReconstructionObligationLedger.disposition.test.ts
      (new, 9 tests): retires a generated obligation without competing with it
      (without a binding, and with a fixtureless binding); keeps a required
      out-of-scope reviewed obligation required and the ledger open; does
      not hide sibling obligations or their closure work; rejects a retiring
      disposition with an empty, blank, or missing reason; rejects a reason on
      a disposition that does not retire; still reports an active reviewed
      definition that reuses a generated ID.
    • src/application/ReconstructionObligationCandidates.test.ts (updated):
      reports one artifact-level limitation only above the threshold and keeps
      every candidate; keeps the limitation when reviewed dispositions retire
      the surplus and reports the unreviewed count; does not reach ready when
      the real bridge and every decoy bridge are retired.
    • tests/boundary/javascript/reconstructionObligationDecoyFlood.test.ts
      (new, 1 test): end-to-end decoy flood through the JavaScript boundary;
      the real context-bridge obligation survives while decoys are flagged.
  • Base reproduction or other evidence: source-derived, not executed against
    the base. On the base revision addCandidate kept the first definition and
    reported a second one as duplicate-definition, a reviewed record's own
    required: false governed whether its claim counted as open work, and the
    reviewed schema accepted out-of-scope with no reason, so the new
    disposition tests would not pass there.
  • User-visible CLI/MCP output (if applicable): limitation text, e.g.
    obligation-overgeneration: artifact <sha256> has 24 generated obligations with no runtime authority and no manifest binding (families: context-bridge), above the threshold of 20; 3 still unreviewed, 21 retired by reviewed disposition. Stop: do not write fixtures or verifiers for these candidates; ...
  • Remaining proof gaps: the decoy-flood boundary test has not been executed
    locally (see validation); the threshold of 20 is not yet calibrated against
    a large real application.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

All on Windows 10 with Node v24.22.1 (the pinned version), on the rebased
head 94a39a7d0e5310ad00b3a75bf7b0af4ff3d01228 (rebased onto origin/main
at 887b99888e54122accdc721737e5cafe39838f5f, no conflicts).

  • npm run test:focused -- src/application/ReconstructionObligationCandidates.test.ts src/application/ReconstructionObligationLedger.disposition.test.ts src/application/ReconstructionObligationCandidates.semantic.test.ts src/application/ReconstructionObligationLedger.closure.test.ts src/application/ReconstructionObligationLedger.authority.test.ts — 5 files, 59/59 passed, exit 0
  • npm run typecheck — exit 0
  • npx oxfmt --check . — all 7219 files formatted, exit 0
  • npm run lint — 0 errors, 3347 warnings (pre-existing), module boundaries checked (3841 files), exit 0
  • node node_modules/vitest/vitest.mjs run --project mcp-boundary tests/boundary/mcp/reconstructionObligationLedgerMcp.test.ts tests/boundary/mcp/compactInputSchemaMcp.test.ts — 2 files, 49/49 passed, exit 0
  • npm run docs:check — README consistency 9/9 passed, exit 0
  • NOT run locally: tests/boundary/javascript/reconstructionObligationDecoyFlood.test.ts.
    The Windows native path fails on this host (Win32 error 87), which is
    pre-existing on the base commit and unrelated to this change. The test runs
    on the Linux boundary shard in CI; its result is unverified until that
    shard reports.

Compatibility, safety, and release

  • Breaking changes or migration steps: caller input only. A previously valid
    reviewed record { "disposition": "out-of-scope", ... } without a
    disposition_reason is now rejected; add a non-blank disposition_reason
    stating why the claim is retired. Retained ledgers and stored Evidence do
    not change shape and need no migration. Compatibility cannot be preserved
    without keeping reason-less retirement, which is the self-certification
    path this PR closes.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (no provider
    change).
  • Package or release metadata impact: none; docs:check passes.
  • Security, privacy, process, or containment review: no new target
    interaction. The change narrows what caller input can assert about
    closure.

Author readiness

Human owner: @BaaRai

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds reasoned retirement of generated obligations without treating retirement as completed proof, plus advisory notices for artifacts with many static-only candidates.

  • Retirement reviews keep generated obligations on the ledger.
  • Large groups of unbound obligations get an advisory ledger limitation.
  • Runtime Evidence counts only for the artifact it actually observes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Admitted Evidence bundle"] --> B["Request-local capture cache"]
  B --> C["Generate process candidates"]
  B --> D["Check review Evidence"]
  C --> E["Merge reviewed dispositions"]
  D --> E
  E --> F["Check supplied proof and required open work"]
  F --> G["Ledger with advisory flood notices"]
Loading

Reviews (11) · Last reviewed commit: "perf(obligations): parse each capture on..." · Reviewed by Greptile

A generated obligation could be closed by adding a reviewed record that
named the same id and retired it, so an agent could clear a decoy flood by
asserting every claim out of scope and reach a ready ledger with no proof.
Reviewing a generated claim also silently cleared its required flag.

Keep the generated definition's required value when a reviewed record
retires it, so a retired required obligation stays open work. Exclude
nothing from the over-generation count: a retired claim still counts, and
the limitation now reports how many are still unreviewed against how many
were retired, so the signal survives review.

Require a non-blank disposition_reason for the two retiring dispositions and
add not-applicable, which mirrors the existing out-of-scope diagnostic, so a
retirement always states why. A fully retired artifact never reaches ready
and stays flagged until runtime authority or a manifest binding exists.
@BaaRai
BaaRai force-pushed the feat/obligation-disposition branch from 6374f08 to 94a39a7 Compare November 8, 2026 02:19
@BaaRai
BaaRai marked this pull request as ready for review November 8, 2026 02:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T19:19:04.986512Z
We couldn’t complete this review. Comment @codex review to try again.
09fe166 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: 94a39a7d0e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@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: ecff95e2f0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

A retired generated claim skipped its binding evaluation, so a supplied
fixture or verifier proof that failed was hidden. Run the binding check for
retired claims and keep only the proof failures (fixture-failed,
verifier-failed, contradiction); diagnostics that would demand more fixtures,
a verifier, or authority are still dropped, so a retired claim demands no work.

A retiring review that cited observed process or service Evidence recomputed
the generated claim's source_state to observed, which removed it from the
over-generation count. Keep the generated source_state when a review retires
a claim; the review Evidence is still attached.

A second retiring record for one generated ID overwrote the first review, and
a record for another obligation_version retired a claim it did not name. Both
are now competing definitions reported as duplicate-definition. Reviewed
records merge in a canonical order so the result does not depend on input
order.

Static-authority families (native exports, addons, P/Invoke) are satisfied
without runtime authority, so exclude them from the over-generation group
instead of telling the agent to obtain runtime authority for them.

@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: ddf8dc75ae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

A retired generated claim reports status out-of-scope ahead of
contradicted, so an authenticated contradiction it still carried left
the ledger open instead of failed. The ledger status predicate now
treats a contradiction diagnostic as failing, like fixture-failed and
verifier-failed; the schema refinement reuses the same predicate.

Also compute each reviewed record's canonical order key once before
sorting instead of digesting both records on every comparison.

@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: 0e692412f3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Only the first retiring review of a generated claim kept its source
state. A later review, a second retiring record or an active one,
recomputed source_state from every reference, so an observed process
capture cited as review Evidence made a retired decoy look observed.
It then dropped out of the over-generation count, and the ledger could
report open with complete coverage while the decoy flood was hidden.

Every reviewed record merged into a generated claim now keeps the
generated source state while its review references are still attached.
Duplicate-definition reporting is unchanged.

Also pin and document that a blocked reviewed claim with an
authenticated contradiction fails the ledger, and document that a
contradiction on a retired claim fails it too.
@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@BaaRai thanks for the PR — there are 4 open review threads here:

Could you address or reply to these? Once they're resolved and CI is green we can take another look.
cc @gensokyo-dev @dandgabr

@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@BaaRai also, this branch has merge conflicts with main — please resolve those along with the open threads.

…sition

# Conflicts:
#	src/application/ReconstructionObligationLedgerEvaluation.ts
A complete graph with more than the threshold of unbound candidates flipped coverage to partial and the ledger to unknown although nothing was truncated. The obligation-overgeneration limitation stays listed but no longer changes coverage.status or the ledger status; retired claims stay required, so a fully retired artifact still cannot reach ready.
Grouping unbound candidates copied each artifact bucket per insertion, which is quadratic in the candidate count of one artifact. Append to the existing bucket instead and cover a 5000-candidate artifact.
Retiring every claim while citing one observed process capture of another artifact must not shrink the over-generation count, drop a limitation, or improve coverage or status. The generated source state already ignores review provenance; this pins it.
A retired claim already keeps supplied fixture and verifier failures (RETIRED_PROOF_FAILURES) while dropping requests for missing proof. Pin the verifier path next to the existing fixture case: a failing verifier fails the ledger, a passing one leaves it open.
Two retiring reviews for one ID applied only the canonical first; the other review's reason was dropped behind a generic duplicate-definition diagnostic. Each retiring record that is not applied now adds a duplicate-definition diagnostic carrying its disposition and reason, so the output names every reason independent of input order.
Over-generation is computed once from the obligations as a per-artifact value (total, retired, unreviewed, families). The limitation text is rendered from it, evaluation passes only closure limitations to coverage and status, and the schema check removes the advisory text it re-derives from the obligations instead of matching a limitation prefix. Output and contract are unchanged; a test pins the rendered text.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

…the artifact

- Record limitation_kinds beside limitations so coverage and status read a
  structured kind, never the advisory sentence. The field is optional: a
  ledger retained without it derives its kinds from its obligations.
- Count over-generation in one pass with a fold that updates each
  artifact's tally in place.
- Mark observed runtime Evidence cited by a review as other-artifact when it
  does not observe the obligation's target artifact; it no longer clears
  static-only or counts in by_evidence_authority.
- Read unknown diagnostics for ledger status so retirement never improves
  it, and apply no retirement to a contested definition, matching the other
  duplicate paths in either order.
- Assert facts and formatter output instead of full sentences, and drop the
  fixed decoy-flood test deadline.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

…aims

- Read residual-unknown, unavailable-authority and duplicate-definition
  diagnostics for ledger status only on retired (out-of-scope) claims, so
  retirement still never turns unknown into open while active and blocked
  claims keep the status rule main uses. A blocked claim with unknown
  residue stored open parses again.
- Accept the status rule a ledger was written under when it has no
  limitation_kinds, so ledgers retained from main with a retired claim
  carrying unknown residue keep parsing; ledgers with kinds are read by the
  current rule only.
- Mark a non-process controlled-replay record cited by a review as
  other-artifact when it does not observe the obligation's artifact, so
  summary.by_evidence_authority stops counting it.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Review authority and the observed artifact now read one per-request parse of each capture, keyed by Evidence ID, instead of parsing the same payload twice per citing review.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@BaaRai

BaaRai commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

All threads are resolved, CI is green on 09fe166, and the PR is CLEAN.

Since your review:

  • Retiring a claim no longer improves anything: retired required obligations stay required and counted, so a ledger cannot reach ready on assertions.
  • Over-generation no longer rewrites coverage, so a complete graph with 21 unbound candidates stays complete instead of flipping to unknown.
  • Review provenance no longer stands in for runtime authority, including when the cited capture belongs to another artifact.
  • The retained ledger now carries limitation kinds, optional, so a wording change cannot flip a saved ledger and older ledgers still parse with their stored status.

One behaviour worth your eye: a fully retired artifact never reads ready by design, until runtime authority or a manifest binding exists. That is in the reference doc.

Ready for your merge call.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants