Repository navigation
Add comment-memory storage for ledgers - #77362
Conversation
Reuse ledger transactions, canonical records, built-in replay and managed comment helpers. Store immutable bounded comment shards behind trusted persistence with target-scoped serialization. Validation: focused compiler and JavaScript tests, typecheck, fast progress gate and workflow drift passed. The full gate is blocked by pre-existing custom Go lint diagnostics in ledger.go and tools_merger.go. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
This comment has been minimized.
This comment has been minimized.
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully!
|
There was a problem hiding this comment.
Reviewed the changed lines and related implementation paths. I found no actionable correctness, security, performance, or maintainability issues that warrant a blocking review comment. Static review only; tests were not run per review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
What this change does: It adds comment-memory storage for ledgers while reusing ledger validation and projections. Git storage remains the default.
Should fix
-
Write the configuration once (
pkg/workflow/compiler_main_job_ledger.go:17)- What this is: The main job writes comment-memory configuration for ledger projection and later for memory preparation.
- Problem: A comment-backed ledger causes the same configuration step to run twice.
- Fix: Reuse the earlier write for both readers and skip the later step in that case.
- If we skip it: Every affected run retains an unnecessary action and eight generated YAML lines.
Verdict: Ship.
Lean: -8 lines possible.
Generated by ✂️ Ponytail Reviewer for #77362 · codex · routed: gpt61 medium · ~12 AIC · ⌖ ~1 AIC · ⊞ 182
Comment /ponytail to run again
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. ❓ Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
Persist canonical JSONL directly in fenced comments and expose read-only ledger.jsonl files to agents instead of SQLite databases. Reuse shared JSONL parsing, segment validation, and built-in reducers, and reject publication transformations that would invalidate record hashes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep durable comment shards as readable JSONL while reusing the existing read-only SQLite projection, query guidance and built-in replay for agent access, matching repo-memory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd, /codebase-design, and /grill-with-docs, guided by the pr-triage classification (new_feature). Requesting changes because two defects in the comment-memory ledger path are reproducible.
📋 Key Themes & Highlights
Blocking
- Data loss on rotation: a batch that rotates the segment writer reports
persisted: 3, but only the last shard is posted, so earlier records are unrecoverable. - Forged records accepted:
materializeCommentLedgerhas no author check. A record with a correctsha256planted in a comment is accepted into the ledger, and a malformed shard blocks every later persist.
Non-blocking
setup_comment_memory_files.cjs: a badtarget-reponow throws and skipsinjectCommentMemoryPrompt. This changes behavior for existing comment-memory users.ledger_job.go: permissions are upgraded withstrings.Replaceon formatted YAML.compiler_main_job_ledger.go: unnecessaryfmt.FprintftoWriteString(fmt.Sprintf)churn.- The spec says nothing about rotation, so the immutability guarantee is unenforced.
- The tests do not cover multi-segment rotation or planted shards.
Positive Highlights
- ✅ Clear separation between the comment backend and the Git backend in
appendLedgerRecords. - ✅ Size limits and staged mode fail closed.
- ✅ The existing suite covers conflicting transaction IDs and corrupt-history diagnostics.
@copilot please address the review comments above, starting with the rotation data loss and the shard-author check.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~13 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
Preserve upstream comment-memory transaction history alongside ledger tags and typed JSONL blocks, and regenerate maintenance configuration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical ledger flaws can discard validated transactions, accept forged history, and silently restore incomplete state, risking data loss and failures in subsequent projections and writes.
6 open issues
Unauthenticated comments can forge accepted ledger history · New Malformed ledger blocks silently erase history · New Shard rotation drops earlier records · New Comment token client breaks Git-backed ledgers · New Pending persistence jobs are replaced when queuing is enabled · New Validation errors omit field, rejected value, and example · New
What changed in this PR
Adds an optional comment-memory backend to gh-aw ledgers, allowing existing ledger operations and SQLite projections to use an issue or PR instead of a Git branch. Git remains the default backend.
Changes:
- Add storage selection and validate comment-memory dependencies, targets, and compaction restrictions.
- Integrate comment-backed restoration and persistence with token configuration, permissions, staged mode, and target-level concurrency.
- Extend schemas, documentation, and tests for comment-backed and mixed-storage workflows.
| File | Description |
|---|---|
pkg/workflow/ledger.go |
Adds backend configuration and comment-storage compaction restrictions. |
pkg/workflow/ledger_test.go |
Tests configuration, compilation, and mixed-storage permissions. |
pkg/workflow/ledger_job.go |
Wires persistence configuration, credentials, permissions, staging, and concurrency. |
pkg/workflow/compiler_orchestrator_workflow.go |
Validates required comment memory and literal targets. |
pkg/workflow/compiler_main_job_ledger.go |
Configures comment-backed projection preparation. |
pkg/parser/tools_merger.go |
Recognizes scalar storage settings in single-ledger declarations. |
pkg/parser/tools_merger_test.go |
Tests storage-setting and named-ledger recognition. |
pkg/parser/schemas/main_workflow_schema.json |
Defines supported storage values and configuration forms. |
docs/src/content/docs/specs/repo-memory-ledger-specification.md |
Documents comment-storage lifecycle, constraints, and limits. |
docs/src/content/docs/reference/frontmatter-full.md |
Adds the storage option to the frontmatter reference. |
actions/setup/js/setup_comment_memory_files.cjs |
Exposes shared target resolution and configuration loading. |
actions/setup/js/push_ledger_changes.cjs |
Shares append validation and dispatches persistence by backend. |
actions/setup/js/create_ledger_projection.cjs |
Restores comment-backed history before projection creation. |
actions/setup/js/comment_memory.cjs |
Supports a separate ledger tag in managed-comment rendering. |
actions/setup/js/comment_memory_ledger.test.cjs |
Tests all six ledger types, retries, limits, staging, and failures. |
actions/setup/js/comment_memory_ledger.cjs |
Implements comment scanning, shard restoration, and batch publication. |
actions/setup/js/comment_memory_helpers.cjs |
Parameterizes memory tags while preserving existing defaults. |
Review effort: Max (dynamic)
Publish all rotated JSONL shards atomically, verify authenticated comment authors with shared credential resolution, isolate comment writer tokens from Git-backed ledgers, reuse typed permissions and token metadata, remove duplicate setup configuration, and complete the ADR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
In reply to #77362 (comment) Accepted the associated duplicate-step finding. The agent job now shares its early comment-memory configuration between projection and memory preparation, with focused regression coverage. |
|
In reply to #77362 (comment) No change needed for this notification. The associated static code-quality review reported no actionable findings. |
|
In reply to #77362 (comment) Reviewed and completed the generated ADR with concrete rationale, alternatives, and consequences, and linked it in the PR description. Its status remains Proposed pending maintainer review. |
|
In reply to #77362 (comment) No code change was requested by this notification. Independently added and ran focused regression coverage for shard rotation, untrusted comment authors, and the shared agent projection. |
|
In reply to #77362 (comment) Accepted the substantive findings from the completed skills review. Publication now preserves every rotated shard, and ingestion verifies the selected writer's identity instead of trusting a marker or arbitrary bot author; focused regressions cover both cases. |
|
In reply to #77362 (comment) No change was requested by this completion notification. The specification now explicitly describes readable JSONL comments, the shared read-only SQLite projection, and the rotation and authenticated-author invariants. |
|
In reply to #77362 (comment) Accepted. Completed the ADR's context, decision, alternatives, and consequences and linked it in the PR description, without claiming maintainer approval. |
| if data.LedgerConfig.hasCommentStorage() { | ||
| permissions.Set(PermissionContents, PermissionRead) | ||
| permissions.Set(PermissionIssues, PermissionWrite) | ||
| permissions.Set(PermissionPullRequests, PermissionWrite) |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "b9c054bbf88adddf8935e0a0bbbf8ba010507518",
"kind": "requested",
"schema_version": "1",
"state": "d9e09688cca754be2f5b4ff0517d5cb866ba55bf740fca19b5b0b51359742128",
"work": [
"06ee8ef38e1bf49770c3c40f5d967c6d3ebc0d603c155e141e7699b89abd64c0",
"078e6675393ce6769eef2b960932783bb8847a81110a854e8704a80ae62c3a34",
"12e2d92b8c5b535f1d3147e14962e78f9a50d376e8a16f13e4326968dc5aa3f5",
"1612451f13c5d54618082aa0d5b67fe89e2c3d1f16e5cfc6506fa9a24c2e9a24",
"20c5fb9e2e37672daf5b7271dae9c95ff59f03cf41d0cde5ac7e2acc9456d2d1",
"57b160f058c0cf0ae8470606e768b98956d9e31df7d52cc35017efdeeaeffab1",
"59286ccd5b9a5d99c99f1f6ee41b805e9b73c298ad70c14863196bf31fdbf8da",
"61de1bdb227e3731911529f00f65e50933350c026742f49b33b6e8ffdc2c92c9",
"b946191b4d48ccbefd5245ab587c85f3a18094d252eac07de64953ec17d71dcc",
"c03fdf64ae0afb7631cc55db5ec7e4057557a32c5aff692ff4c20c9d7a061fc0",
"cabafb2817b103330ac0d1e2e098f214c40c4ca2be128895a8b14391f7e3306f",
"e12f3ca123426c7ce7fac5980fecb0c13ba9a8c82172ef9a9c5c18b414b029f6"
],
"workflow": "pr-sous-chef"
}
|
…ry-ledgers Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot enable comment memory tool ledger in some of the agentic workflow reviewers |
Reject malformed selected-ledger fences, prevent managed agent comments from emitting reserved ledger blocks, honor group concurrency queue policy, and make validation diagnostics actionable. Document the verified-publisher trust boundary selected for this backend. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve incoming review and CI fixes, combine the rotation specification, and keep schema prompt truncation Unicode-safe with a focused regression. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Compile Markdown fixtures for comment-only, imported mixed-storage, staged queue opt-out, and default Git ledgers. Inspect generated YAML for cross-job configuration, permissions, credentials, ordering, queue policy, and transaction artifact handoff. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "81f9e94be8d4ca1aa9d714d84ff9efa909763a7c",
"kind": "requested",
"schema_version": "1",
"state": "65d32e780a57d155660b3d68d3ca70e2f5c36c7829f7160217b77b2a2976c517",
"work": [
"2ec1c55a56c3bbc3d439b0f0d819e0f964a9c8ea5c8bbe45cc9676c7e7802a18"
],
"workflow": "pr-sous-chef"
}
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Both PR reviewer workflows now enable comment-memory ledgers for review history. This was implemented in |
|
🎉 This pull request is included in a new release. Release: |


Ledgers currently require Git-backed storage, even when a workflow already uses issue or PR comment memory. This adds
storage: comment-memoryso workflows can use the existing ledger operations against their configured comment-memory target.Approach
/tmp/gh-aw/ledgers/<name>/ledger.dbSQLite projection used by repo-memory for agent queries.queue: maxwhen enabled. Git remains the default backend.Limits and trust boundary
JSONL batches are limited to 16 KiB and each ledger to 48 KiB total, without comment compaction. Targets must be literal issue/PR numbers or the triggering item. Opaque tokens fail explicitly when their publishing identity cannot be verified.
The agreed trust anchor is the verified publishing identity: holders of that credential are authorized writers, as with Git writer credentials. The managed-publication guards are not cryptographic authentication, and no separate signing key is required. Independent writers needing stronger isolation need a different credential or independently verified integrity mechanism.
Queue limits and workflow cancellation still apply; opting out of
features.group-concurrency-queuerestores pending-job replacement. Writers in different repositories sharing a target must coordinate externally.Architecture decision
ADR: Comment-memory storage for ledgers. The ADR is complete and remains Proposed pending maintainer review.
Validation
Preserved concurrent remote review/CI fixes and main updates, resolved the overlapping rotation documentation, and fixed an incoming Unicode-unsafe schema excerpt with a failing-then-passing regression. Focused Go checks, 415 JavaScript tests, typechecking, build, the fast progress gate, and all 366 workflow drift checks passed. Safe-output conformance reported no critical or high failures, with existing medium/low warnings.
Regressions cover all six JSONL-to-SQLite round trips, rotation and atomic retries, forged/malformed untrusted shards, malformed selected fences, same-publisher managed publication, selected-token binding, credential separation, queue opt-in/out, single configuration writes, actionable validation errors, and UTF-8 preservation.
The full
make agent-report-progressgate previously reported baseline custom Go lint diagnostics forsort.Stringsinpkg/workflow/ledger.goand string-to-byte JSON decoding inpkg/parser/tools_merger.go; fulltest-unitwas not repeated.