Bolt 4: Intent autonomy の自動裁定 review / observability surface を追加する - #2229
Conversation
…time Ports the evolved Bolt 4 surface from codex/intent-autonomy onto the landed Bolt 3 core: the harness-neutral review projection (amadeus-autonomy-review.ts), the production adapter (amadeus-autonomy-review-production.ts), the harness id catalog, and the amadeus-bolt list/get/review-auto-decision verbs, all driven in-process by t433/t435. Registry lands AUTO_DECISION_REVIEWED as canonical event 89; the INTENT_COMPLETION_TRANSACTION_COMMITTED seal stays Bolt 5 vocabulary — the review path only reads it, so the t433 fixture seeds the shard row directly instead of routing the registry-guarded emitter.
…ed-source arm Also registers AUTO_DECISION_REVIEWED in the state-machine emitter taxonomy, moves t433 to the integration layer (real-FS medium), and allowlists two bolt flag-read lines that execute on the in-process t435 drive but stay 0 under bun's union-merged lcov.
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthrough自動判断の人的レビュー機能を追加した。レビュー状態、ダイジェスト、認可、永続化、監査イベント、production API、CLI、統合テストを実装した。監査イベント総数を89件へ更新した。 Changes自律判断レビュー
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d09470f. Configure here.
…, content binding, and set ordering Cursor Bugbot raised three findings; each traced to the record's functional-design contract and all three were real deviations: - OBS-R08: a completed target's journal is sealed (#1248), so commitProductionDecisionReview now lands AUTO_DECISION_REVIEWED on the ACTIVE SOURCE journal and readStoredReviews unions sibling shards by the payload's target uuid; persistence validation admits the extension overflow only for a sealed completed lifecycle. - OBS-R09/OBS-R12: a fresh human turn no longer authorizes arbitrary caller flags — get-auto-decision --choice previews a confirmation digest over (target, decision, choice, flag metadata with explicit nulls) and review-auto-decision must present it back; the commit recomputes and refuses a mismatch. - Event-set contract: eventSetDigest now sorts by the closed event-type order then canonical event id, dedupes identical (id, digest) pairs, and closes diverging duplicates as CONFLICT(projectionEventSet) instead of silently encoding both.
…mechanism ratchet
There was a problem hiding this comment.
Actionable comments posted: 24
🤖 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 `@packages/framework/core/knowledge/amadeus-shared/audit-format.md`:
- Line 259: `AUTO_DECISION_REVIEWED` のエミッター表記を、フィールドを組み立てる `reviewAuditFields` の
`tools/amadeus-autonomy-review.ts` から、実際に `emitAuditEventGuarded` を呼び出す
`commitDecisionReviewLocked` の `tools/amadeus-autonomy-review-production.ts`
に更新する。`docs/reference/12-state-machine.md` と一致する表記を維持する。
In `@packages/framework/core/otel/event-registry.ts`:
- Around line 232-256: Update the event vocabulary in the relevant registry
definition to include “Event Identity” and “Projection Revision” as optional
attributes, and remove “Trace Id” and “Span Id” if they are not supplied by the
publishing path. Synchronize the Optional attribute list in audit-format.md with
the same vocabulary so reviewAuditFields values are retained by default-deny
redaction.
In `@packages/framework/core/tools/amadeus-autonomy-review-production.ts`:
- Around line 156-167: Remove the redundant String(...) coercions in the payload
mapping within the relevant review-production function, directly reusing the
validated string fields from parseReviewPayload. Preserve the existing nullable
handling for grantId, and keep the already direct references consistent with the
remaining fields.
- Around line 170-173: Update the projection mapping around the redactionStatus
assignment to propagate the validated payload.redactionStatus value instead of
always setting "redacted". Preserve the existing validation that accepts the
supported "redacted" and "withheld" record values so the projection matches the
audit entry.
- Around line 395-406: Update commitProductionDecisionReview to derive the
ledger once and lock the journal being written: use the active source for
completed targets and the target otherwise. When target and source differ,
acquire both audit locks in a deterministic order, retaining the target lock for
its auditRevision check, then perform reads and writes under the appropriate
lock scopes so concurrent reviews sharing a source are serialized without
deadlocks.
- Around line 66-87: Update currentSeed and completionSeal so readAllAuditShards
is invoked only once per target: obtain the audit-shard result in currentSeed,
pass it to completionSeal, and reuse it for splitAuditRecords. Adjust
completionSeal’s parameter/type as needed while preserving the existing seal
validation and seed values.
- Around line 409-417: Move both resolveReviewTarget calls in
commitProductionDecisionReview inside the existing try block so filesystem
exceptions from activeSpace, activeIntent, or listIntents are handled by the
function’s established error path. Keep the active-source and review-target
validation behavior unchanged after resolution succeeds.
- Around line 264-269: Unify redaction between read and commit paths by
extracting the redactor currently defined in reviewService into one shared
definition and reusing it when createMemoryAutonomyReviewService is called for
commits. Update the redactor callback’s _kind parameter to the appropriate
public RedactionKind type, while preserving NFC normalization and the "redacted"
status.
- Around line 199-211: 分離された Intent
の監査行の解析失敗が対象の読み取りを中断しないよう、`parsedReviewEvent` を呼ぶ前に行の対象 UUID を判定し、対象外ならスキップし、対象
UUID の行だけ解析例外を再送出してください。あわせて `own` と active 経路でもイベント識別子を共有して重複排除し、`extension`
と同じく各行を一度だけ処理して `reviewExtension` の重複加算を防いでください。
- Around line 140-146: Update parseReviewPayload to runtime-validate
decisionSource, remediation, and flagClassification against their respective
literal-union allowed values before constructing AutoDecisionReviewedEvent.
Reject invalid strings rather than relying on type casts, while preserving the
existing event-generation flow for valid values.
- Around line 342-355: Bind the confirmation digest to the server-created
HUMAN_TURN record rather than recomputing it solely from commit inputs in the
review commit flow. Store the displayed-content digest or a server-issued
confirmation token when creating the human turn, then have the validation around
expectedContentDigest compare input.confirmedContentDigest against that
persisted value before accepting the commit; otherwise remove the comments
claiming this provides human content-attestation.
- Around line 330-341: Update the HUMAN_TURN provenance flow around
findAllEvents and the latest prior review lookup to use each event’s unique
eventId rather than its timestamp. Propagate that eventId through
sourceHumanTurnId, sourceHumanTurnEventId, commandOccurrenceId, and all
re-matching logic, while preserving the existing consumed-turn and
PROVENANCE_REQUIRED behavior. Ensure sourceHumanTurnId and
sourceHumanTurnEventId are never populated with the same timestamp.
In `@packages/framework/core/tools/amadeus-autonomy-review.ts`:
- Around line 745-758: Update put to validate every retained review’s decisionId
against the new seed.autonomy.autoDecisions projection before replacing the
intent; reject the update when any retained review references a missing
decision, matching validatePersistedReviewState’s invariant while preserving
valid retained reviews.
- Around line 388-417: Update validatePersistedReviewEvent to compare every
remaining event field against the parsed payload, including remediation,
flagClassification, grantId, lifecycleAtReview, principalId, actorId,
safeNoteDigest, and commandBindingDigest. Keep the existing digest, identity,
and projection checks unchanged, and reject the persistence payload with the
existing validation error when any comparison fails.
- Around line 1187-1193: Remove the unused, type-unsafe caseResults property
from ReviewHarnessContractResult. Keep evaluateReviewHarnessSuite and the public
contract limited to harnessId, fixtureId, contractRevision, and passed; do not
introduce a replacement case type until case-level validation is required.
- Around line 1175-1181: Align grantId redaction behavior with the other
decision attributes by moving the amadeus.grant.id assignment into the
redactionStatus === "redacted" block. Keep it omitted when the status is
withheld, unless the behavior is intentionally different; in that case, document
the exception with a comment.
- Around line 490-502: Update the decision projection in the `decisions` mapping
to propagate `canonicalContractValueDigest` failures through the enclosing
function’s existing `ContractResult` error path instead of converting
`payloadDigest` failures to null. Keep successful digest values and the
review-side behavior unchanged, ensuring `eventSetDigest` cannot treat an
un-digestible decision as having no payload.
In `@packages/framework/core/tools/amadeus-bolt.ts`:
- Around line 1209-1211: Update the unknown-subcommand message in
handleBoltCommand to include list-auto-decisions, get-auto-decision, and
review-auto-decision alongside the existing supported commands, keeping the
listed commands synchronized with the handlers registration.
- Around line 1004-1015: Update the choice handling in the command flow around
reviewConfirmationDigest to reject an explicitly provided flags.choice whose
value is neither "accept" nor "flag". Call the existing error(...) mechanism and
stop successful output in that case, while preserving digest output for valid
choices and normal result.detail output when --choice is omitted; align the
validation behavior with handleReviewAutoDecision.
- Around line 976-993: amadeus-autonomy-review.ts に reviewCommandContentFields
を公開し、choice に応じた flagClassification と safeNoteDigest の正規化を集約する。amadeus-bolt.ts の
reviewConfirmationDigest と、amadeus-autonomy-review-production.ts の期待値生成および
bindHumanReviewCommand
入力生成の3箇所をこのヘルパー利用へ置き換え、重複する条件式を削除してプレビューとコミットで同一の正規化結果を使う。
In `@packages/framework/core/tools/amadeus-harness-registry.ts`:
- Around line 4-34: Move the HarnessDescriptor declaration before
HARNESS_REGISTRY, then type-check the registry with `as const satisfies readonly
HarnessDescriptor[]` so every entry, including native.liveAuthorization and
related fields, conforms while retaining literal types.
- Around line 59-70: Replace the broad filter-and-cast logic in
PACKAGE_HARNESS_IDS and SELF_INSTALL_HARNESS_IDS with type-predicate filtering
so each result is inferred as the corresponding harness ID type without as
assertions. Remove the unused ValidatedHarnessRegistry interface from this file.
In `@tests/integration/t433-autonomy-review-observability.test.ts`:
- Around line 536-538: Update the idempotency assertion around
service.appendDecisionReview to explicitly verify that the first result has an
accepted status before comparing first and again with toEqual, ensuring the test
only passes for a successful outcome.
- Around line 831-838: テスト「dedupes a duplicated event id with identical payloads
to one entry」で、page.ok の確認に加えて event-count
を再計算し、直前のテストと同じ方法で期待するダイジェストと比較してください。重複した 2 件が 1 エントリに畳み込まれる結果を明示的に検証し、dedupe
の退行を検出できるようにします。
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 421b75e0-6deb-497e-b77a-ffce5f0efa69
⛔ Files ignored due to path filters (12)
amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/code-generation/code-generation-plan.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/code-generation/code-summary.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/functional-design/business-logic-model.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/functional-design/business-rules.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/functional-design/domain-entities.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/functional-design/functional-design-questions.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/nfr-design/logical-components.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/nfr-design/nfr-design-questions.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/nfr-design/performance-design.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/nfr-design/reliability-design.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/nfr-design/scalability-design.mdis excluded by!amadeus/spaces/*/intents/**amadeus/spaces/default/intents/260803-intent-autonomy/construction/autonomy-review-observability/nfr-design/security-design.mdis excluded by!amadeus/spaces/*/intents/**
📒 Files selected for processing (19)
docs/reference/12-state-machine.mdpackages/framework/core/knowledge/amadeus-shared/audit-format.mdpackages/framework/core/otel/event-registry.tspackages/framework/core/tools/amadeus-audit.tspackages/framework/core/tools/amadeus-autonomy-review-production.tspackages/framework/core/tools/amadeus-autonomy-review.tspackages/framework/core/tools/amadeus-bolt.tspackages/framework/core/tools/amadeus-harness-registry.tstests/.coverage-patch-allowlist.jsontests/.coverage-ratchet.jsontests/.coverage-registry.jsontests/integration/event-registry-drift.test.tstests/integration/t-coverage-mechanism-ratchet.test.tstests/integration/t433-autonomy-review-observability.test.tstests/integration/t435-intent-autonomy-production.integration.test.tstests/no-silent-drop/baseline.jsontests/no-silent-drop/exemptions.jsontests/unit/t28-audit-event-sync.test.tstests/unit/t81.test.ts
- lock every ledger the review commit reads or writes: target and source are both audit-locked in deterministic dirName order, so two completed-target reviews serialise on the shared source journal and the one-review-per-turn property holds under concurrency - identify HUMAN_TURN consumption by timestamp plus same-second ordinal instead of the second-precision timestamp alone - normalize flag metadata in one exported helper shared by the preview digest, the commit-side recomputation, and the command binding - propagate the recorded redactionStatus instead of pinning "redacted", share one production redactor across the read and commit services, and validate the literal unions during payload parsing - isolate sibling-journal parse failures (fail closed only when the raw row names the target uuid) and dedupe review events across journals - registry/audit-format: carry Event Identity and Projection Revision in the AUTO_DECISION_REVIEWED vocabulary; correct the documented emitter - eventSetDigest propagates decision digest failures as MALFORMED; put() re-validates retained reviews against the replacement projection; persistence validation compares every payload field - bolt: reject an invalid --choice on get-auto-decision, list the three review verbs in the unknown-subcommand message - harness registry: satisfies-typed rows, predicate-narrowed id lists, drop the unused ValidatedHarnessRegistry - tests: pin idempotent accept state, pin the dedupe digest to one entry, drop the removed caseResults field

概要
Delivery Plan の Bolt 4 / U4
autonomy-review-observabilityを実装します。マージ済みの Bolt 3(#2211)の Intent-scoped autonomy Core に、自動裁定の確認 surface(accept / flag)と観測面を追加します。Refs #2067
主な変更
amadeus-autonomy-review.ts: append-only な review projection — 未確認キュー(unreviewed)、accept / flag、flag の分類(contract-defect/specification-change)、snapshot 永続化、redaction、human / machine status 投影、review telemetry。review は決定済み effect を再実行せず、grant を変更せず、完了済み Intent を rollback しないamadeus-autonomy-review-production.ts: record / audit shard を読む production adapter — active / completed 両 lifecycle の review、completed Intent は completion seal を読み取り検証(sealed source からの新規 review は fail-closed)amadeus-harness-registry.ts: 現行 5 harness の id カタログ(review harness suite の評価面)amadeus-bolt.ts:list-auto-decisions/get-auto-decision/review-auto-decisionの 3 verb を追加(t435 で in-process 駆動)AUTO_DECISION_REVIEWEDを canonical 89 件目として event registry / audit 語彙 / audit-format / state-machine emitter 台帳 / 同期テスト(t28 / t48 / t81 / registry-drift)へ同期スコープ境界
INTENT_COMPLETION_TRANSACTION_COMMITTEDは registry へ登録せず(review 側は seal を読むだけ)、t433 の fixture は registry を通さない raw shard 追記で seed検証(いずれもローカル実測、exit code 0)
bun run typecheck/bun run lint/bun tests/complexity-gate.ts --check/bun run source-only:checkbun run build(全 harness dist 再生成)bun run coverage:ci: Failed 0 / RESULT: PASSbun tests/coverage-patch-gate.ts --check: added 1,034 行 / covered 1,032 / allowlisted 2 / uncovered 0レビュー観点
VerifiedHumanTurn.actorの型ドリフト是正、t433 の completion seed を registry-guarded emitter から raw shard 追記へ変更(Bolt 5 語彙の先取り回避)Note
Medium Risk
Touches append-only audit writes, human-turn provenance, and completed-Intent seal/extension rules—security- and integrity-sensitive paths, though scoped to observability without effect replay or grant mutation.
Overview
Bolt 4 / U4 adds a post-hoc review and observability surface for immutable auto-decisions on active and completed Intents, without replaying effects, changing grants, or reopening completed workflows.
New Core modules
amadeus-autonomy-review.tsandamadeus-autonomy-review-production.tsimplement snapshot-bound listing/pagination, redacted detail, real-HUMAN_TURNauthorization, terminalAUTO_DECISION_REVIEWEDappends (idempotent same choice / conflict on different choice), completed-Intent post-seal review extension chains, safe flag remediation suggestions only, status/telemetry projection, and tamper-checked persistence reload.amadeus-bolt.tsgainslist-auto-decisions,get-auto-decision, andreview-auto-decision.AUTO_DECISION_REVIEWEDis wired throughamadeus-audit.ts, OTelevent-registry.ts(canonical count 88→89),audit-format.md, and12-state-machine.md.amadeus-harness-registry.tscentralizes self-install harness IDs for shared contract evaluation. Integration coverage lands int433-autonomy-review-observability.test.tswith registry drift tests updated; large U4 functional/NFR/code-generation docs are added under the intent construction tree.Reviewed by Cursor Bugbot for commit d09470f. Configure here.
Summary by CodeRabbit
新機能
監査・可観測性