Repository navigation
[3483 by Claude Opus 5.5] Durable change-event journal for pull requests and epic queues - #3496
Conversation
…LL-DONE" line is the run completing, which I already covered above: 40 of 41 files passed. The one failure was `test/planIssueManager.ultrafix.test.ts`, which now passes (8/8) after I stubbed the journal module in it. Nothing else needs doing.
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds a repository event journal, instruments lifecycle writers, and supplies retention, activity notifications, documentation, and focused tests. It needs changes before merge because retention can delete recent events and several journal paths can omit real transitions or report incorrect ones. ✅ Transactional event writes — Review scores, PR outcomes, and guarded queue advancement append events within their database transactions. ✅ Failure isolation coverage — Added tests explicitly exercise missing journal tables while confirming that the underlying operations still succeed. ✅ Shared event vocabulary — Event domains and Ultrafix outcomes are centralized, including validation of the new activity domain. This review is a static trace of the supplied code; no commands were run. The authoritative checks show no failures and five pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Retention deletes unexpired events
F2: 🔴 Timestamp deduplication loses repeated status transitions
F3: 🔴 Status events can describe the wrong mutation
F4: 🔴 Returning to a previous head is silently omitted
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has useful coverage and clear integration points, but the verified defects compromise the journal’s retained history and accuracy. The required corrections are localized; pending checks are not themselves blockers. Score: 5/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 0c724d6
Summary of ChangesI fixed F1–F4 and each has a regression test. All six new tests fail on the previous branch code and pass now; the full set of 20 tests in the three journal suites passes. Typecheck (core and api) and lint with zero warnings pass on the changed files. F1 – Retention deleted unexpired events. F2 – Repeated transitions within one second were lost. Status events no longer use a timestamp-based dedupe key. Each event is identified by its own F3 – Status events could describe the wrong row or prior status. A new helper,
New tests cover a write landing between another writer's lookup and its update, a newest row held by its linked review while an older row is updated, and a PR update matching several rows. F4 – A force-push back to an earlier head was dropped.
Without a delivery ID the event is written without a key, because neither the commit nor the before/after pair identifies one occurrence. In production both paths always have an ID. New test: B → C → B → C → B is fully recorded, a redelivery adds nothing, and the last recorded head matches the PR. Other changes:
Wider check: 42 test files that touch these paths, including the plan issue, webhook, routing intake and epic queue suites, pass except one. Separate discovery (not changed): There's no visual change, so I made no previews. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ests fail on the previous branch code and pass now; the full set of 20 tests in the three journal suites passes. Typecheck (core and api) and lint with zero warnings pass on the changed files.
I fixed F1–F4 and each has a regression test. All six new tests fail on the previous branch code and pass now; the full set of 20 tests in the three journal suites passes. Typecheck (core and api) and lint with zero warnings pass on the changed files.
**F1 – Retention deleted unexpired events.** `pruneRepositoryEvents` now deletes only rows older than the 30-day cutoff. The floor (the cursor-expiration boundary) is still one past the highest deleted `seq` and never moves backwards. A cursor below it may have missed pruned events, and unexpired rows below it stay readable. New test: recent events, then an older-stamped late event at a higher `seq`, then another recent one. Only the late event is deleted.
**F2 – Repeated transitions within one second were lost.** Status events no longer use a timestamp-based dedupe key. Each event is identified by its own `seq`. A write that doesn't change the status (a redelivered webhook) is skipped by comparing the row's actual previous status. New test: five transitions with no timestamp manipulation, including `processing → under_review` twice, produce five events.
**F3 – Status events could describe the wrong row or prior status.** A new helper, `updatePlanIssuesWithStatusJournal` in `planIssueStatusJournal.ts`, does three things in one transaction: reads the affected rows and their prior statuses using the writer's own filters (including the linked-review guard), updates exactly those rows, and appends one event per row that actually changed. All three writers use it: `updatePlanIssue`, `updatePlanIssueStatus` and `updatePlanIssueByPR`.
- The production database opens transactions with `BEGIN IMMEDIATE`, so this holds across processes too.
- `stillApplies` still runs before the transaction, because it can do its own database work.
New tests cover a write landing between another writer's lookup and its update, a newest row held by its linked review while an older row is updated, and a PR update matching several rows.
**F4 – A force-push back to an earlier head was dropped.** `head_changed` is now keyed by the GitHub delivery ID: `pr:{n}:head_changed:delivery:{id}`. A redelivery carries the same ID, while a new push is a new delivery. The ID now reaches the journal from both entry points:
- **Direct webhook:** `server.ts` passes it to `processWebhookEvent`.
- **Routing relay:** `RoutingWebSocketIntakeService` passes it the same way.
Without a delivery ID the event is written without a key, because neither the commit nor the before/after pair identifies one occurrence. In production both paths always have an ID. New test: B → C → B → C → B is fully recorded, a redelivery adds nothing, and the last recorded head matches the PR.
**Other changes:**
- `docs/docs/architecture/repository-event-journal.md` is updated to the new retention, status-event and dedupe-key behaviour.
- The fake database in `test/planIssueManager.ultrafix.test.ts` now supports transactions; it passes 8/8.
- To keep `handlePlanIssueTracking` under the four-parameter lint limit, it now builds its own logger from the correlation ID.
**Wider check:** 42 test files that touch these paths, including the plan issue, webhook, routing intake and epic queue suites, pass except one. `packages/core/test/planPRClosedRecovery.test.ts` passes every test it runs but never exits and times out. It does the same on the base code, so this change didn't cause it.
**Separate discovery (not changed):** `linkPRToPlanIssue` sets a plan issue's status to `under_review` but writes no journal event. It was never one of the three journaled writers, so I left it.
There's no visual change, so I made no previews.
PR: #3496
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Full Test Suite Shard 4/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 3598e8c Summary of ChangesI fixed the Shard 4/4 failure. The PR's code wasn't wrong; one test was still checking the old wiring text. What failed: one subtest, Fix (test only): the test now checks the new wiring while still covering what it was meant to protect:
Verification:
There's nothing to see on screen, so I didn't make a preview. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…one test was still checking the old wiring text.
I fixed the Shard 4/4 failure. The PR's code wasn't wrong; one test was still checking the old wiring text.
**What failed:** one subtest, `the daemon wires the same startLoop, unwrapped` in `test/ultrafixBootstrap.test.ts`. The other 248 test files in the shard passed. The test reads `src/daemon.ts` as text and looks for an inline `setUltrafixDeps({ ... startLoop, ... })` block. This branch changed the daemon to call `setUltrafixDeps(createUltrafixDeps())`, so it also installs the journal writer. The regex therefore matched nothing and the assertion failed on an empty string.
**Fix (test only):** the test now checks the new wiring while still covering what it was meant to protect:
- `src/daemon.ts` imports `createUltrafixDeps` from `./jobs/ultrafixBootstrap.js` and calls `setUltrafixDeps(createUltrafixDeps())`.
- `createUltrafixDeps().startLoop` is the same function as the real `startLoop` from `ultrafixOrchestrationService.js`. So the loop still receives every field unwrapped, including the instructions and the user who started it.
**Verification:**
- `test/ultrafixBootstrap.test.ts` passes 3/3 locally.
- `test/ultrafixDaemonResumeSweep.test.ts`, the other root test that reads `daemon.ts`, passes 3/3.
- The only other test that reads `daemon.ts` (`packages/core/test/fleetDataPlane.test.ts`) checks for symbols this PR doesn't touch, so I didn't run it.
- ESLint isn't set up to lint root test files, so there was no lint check to run on this file.
There's nothing to see on screen, so I didn't make a preview.
PR: #3496
Comment by: @propr-dev[bot] (ID: 6830820488)
Model: Claude Opus 5.5
|
CI failed: Full Test Suite Shard 2/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit f05848f Summary of ChangesI fixed the Shard 2/4 failure. The only failed unit was Cause: this branch made Fix: in Check: the suite now passes 11/11 and exits in about 0.3s. I didn't run the full shard again. ESLint skips this file under the core package's config, so there was nothing to lint. The Node.js 20 deprecation message in the failure evidence is only a warning from 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ckages/core/test/planPRClosedRecovery.test.ts`. The PR's code wasn't wrong: in CI all 11 of its tests passed, but the process never exited and was killed at the 180s limit. I fixed the Shard 2/4 failure. The only failed unit was `packages/core/test/planPRClosedRecovery.test.ts`. The PR's code wasn't wrong: in CI all 11 of its tests passed, but the process never exited and was killed at the 180s limit. **Cause:** this branch made `planIssueTracking.ts` call the new `journalPullRequestWebhook`. That module imports the real `db/connection.js`, and the open database handle kept the test process alive after the tests finished. I reproduced the hang locally: all 11 passed, then it hung until killed. **Fix:** in `packages/core/test/planPRClosedRecovery.test.ts`, I stubbed `../src/webhook/pullRequestJournalEvents.js` before the module under test is imported, with a comment explaining why. The stub doesn't hide anything this suite tests: it only sends `closed` and `reopened` events, and the journal ignores those (it only records `opened` and `synchronize`). The earlier `planIssueManager.ultrafix` failure was fixed the same way. **Check:** the suite now passes 11/11 and exits in about 0.3s. I didn't run the full shard again. ESLint skips this file under the core package's config, so there was nothing to lint. The Node.js 20 deprecation message in the failure evidence is only a warning from `actions/checkout` and didn't cause the failure. PR: #3496 Comment by: @propr-dev[bot] (ID: 6831399750) Model: Claude Opus 5.5
Checks FailedValidation failed during setup, tests, CLI packaging, linting, or build checks. View Logs |
|
CI failed: Validate Changes Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 2bfb2ca Processed 2 comments:
Summary of ChangesI fixed the UI typecheck failure that broke Validate Changes. After rebuilding Cause: this branch added Fix: in The "Slow Test" note about 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…s. After rebuilding `@propr/shared`, `tsc --noEmit` in `propr-ui` passes, ESLint passes with zero warnings on the three changed files, and the 49 related UI unit tests pass. I fixed the UI typecheck failure that broke Validate Changes. After rebuilding `@propr/shared`, `tsc --noEmit` in `propr-ui` passes, ESLint passes with zero warnings on the three changed files, and the 49 related UI unit tests pass. **Cause:** this branch added `'pull_request'` to the list of activity domains in `packages/shared/src/activityEvents.ts`. The UI checks incoming events against arrays typed with an older, shorter domain list from `@propr/shared`, which doesn't include `'pull_request'`. Those arrays had `'system'` added by hand to cover the gap, so they rejected the new value. **Fix:** in `useLiveResource.ts`, `useHeaderStats.ts` and `Dashboard/useSectionRefreshTokens.ts`, the arrays are now typed `readonly (ActivityDomain | ScopedActivityDomain)[]`. `ScopedActivityDomain` is imported from `@propr/shared/dist/activityEvents.js`, the same place these files already get the newer event type. Any domain added to that list later is accepted automatically, so this won't break again the same way. No component's behaviour changes; none of them subscribes to `pull_request` yet. The "Slow Test" note about `e2e/creation-short-window.pw.ts` taking 10.3 minutes was only a timing warning, not a cause of the failure, so I left it alone. This is a type-only change with nothing visible in the UI, so there are no previews. PR: #3496 Comment by: @github-actions[bot] (ID: 6832965638) Comment by: @propr-dev[bot] (ID: 6832965826) Model: Claude Opus 5.5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds a repository event journal with transactional writes, deduplication, retention, and activity notifications. It needs a localized correction before merge: concurrent blocked-reason writers can leave the journal inconsistent with the persisted queue. ✅ Retention preserves recent events — Pruning uses event age independently of sequence order, and tests cover delayed events with older timestamps. ✅ Failure isolation — Tests cover journal failures without losing review scores, merge outcomes, plan status updates, or queue advancement. The supplied current-head status reports no failed checks and one pending validation check. This review is a static analysis; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Journal blocked transitions from transactional state
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Clarify status journal coverage
ScoreThe implementation has substantial focused coverage and no reported current-head failures, but the demonstrated queue-journal inconsistency needs correction before merge. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit f05cf4c
Summary of ChangesI fixed F5. A blocked-reason write now decides whether to journal an event by comparing against the reason it reads inside its own transaction, not against the snapshot it took earlier. So going back to an earlier explanation (S → R) is now recorded. What changed
Regression tests (
Verification
There's nothing visual in this change, so no previews. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ournal an event by comparing against the reason it reads inside its own transaction, not against the snapshot it took earlier. So going back to an earlier explanation (S → R) is now recorded. I fixed F5. A blocked-reason write now decides whether to journal an event by comparing against the reason it reads inside its own transaction, not against the snapshot it took earlier. So going back to an earlier explanation (S → R) is now recorded. **What changed** - **`setEpicQueueBlocked`** (`packages/core/src/services/taskPlanning/epicQueueJournal.ts`): inside the transaction it reads the row's current `blocked_reason` and `updated_at`, builds the `blocked` event from that row, and writes only if both values are still what it read. If another write landed in between, it re-reads and tries again, up to 5 times. The extra check matters for databases without SQLite's single-connection serialization; there is no row lock, so a write that keeps losing changes nothing after 5 tries. - **Same defect in the other writers:** - `markEpicQueueHeadBlocked` (`epicQueueBlockedHead.ts`) also built its event before the transaction. It now calls the same helper. It keeps the queue row's own cursor in the guard (the parallel-child event still names the child), and keeps its `:<issue>` dedupe suffix. - `markEpicQueueAwaitingHumanMerge` and the three `setEpicQueueBlocked` callers in `epicExecutionQueue.ts` (merge wait, missing issue, start failure) all go through the helper, so they're fixed too. - **One small side effect:** agent-blocker events now get `occurredAt` set to the row's update time. Before, it was left to the default. **Regression tests** (`packages/core/test/epicExecutionQueueJournal.test.ts`) - Three tests let another writer commit between the first writer's lookup and its transaction: - human-merge → agent blocker → human-merge - agent blocker → human-merge → agent blocker - merge wait (from `advanceEpicQueue`) → human-merge → merge wait Each expects 3 `blocked` events and the final persisted reason. All three fail on the previous code. - One test changes the reason between the in-transaction read and the update. It checks that the retry compares against the new reason. It fails if the read-state check is removed. **Verification** - The journal suite passes 9/9. - `epicQueueBlockedHead`, `epicExecutionQueue`, `autoMergeGate` and `autoMergeGateJournal` pass 69/69. - Core `tsc --noEmit` passes, and ESLint passes with zero warnings on the changed source files. Core's lint config doesn't cover `test/`. - I type-checked the test file separately: the only errors are missing type declarations for the migration imports, and the file already has those on HEAD. There's nothing visual in this change, so no previews. PR: #3496 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a well-organized repository journal, but two correctness issues need localized fixes before merge. ✅ Transactional persistence — Score, outcome, queue, and plan-status writers generally append events alongside their database changes. ✅ Focused regression coverage — Tests cover webhook redelivery, repeated status transitions, append failures, rollback, and retention with out-of-order timestamps. Current checks show no failures, with three still pending. This review used static analysis only; no commands or tests were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F6: 🔴 Repeated blocked transitions can disappear
F7: 🔴 Savepoint completion publishes before durable commit
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has substantial focused coverage, but transition identity and nested-transaction publication still violate the journal’s stated guarantees. Both corrections appear localized; current checks have no reported failures. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 57a1856
Summary of ChangesI fixed both F6 and F7. Each has a regression test that fails on the previous branch code and passes now. F6: repeated blocked transitions disappeared. The blocked event's dedupe key was built from cursor,
F7: an event in a nested transaction was announced before it was durably committed. In
Checks run:
Found separately, not changed: No previews, since nothing here is visible in the UI. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ls on the previous branch code and passes now. I fixed both F6 and F7. Each has a regression test that fails on the previous branch code and passes now. **F6: repeated blocked transitions disappeared.** The blocked event's dedupe key was built from cursor, `updated_at` and a hash of the reason. If the queue went A→B→A→B within one clock tick, the second A→B produced the same key, and the unique index silently dropped that event. - **Fix:** blocked events no longer have a dedupe key. In `setEpicQueueBlocked`, only the writer whose update actually changes the row appends the event, and only when the reason it read differs from the one it writes. That already makes each event unique, so the key wasn't needed. - **Cleanup:** I removed the now-pointless `dedupeSuffix` option and its one caller in `epicQueueBlockedHead.ts`. `epicQueueEvent` now accepts a null key. - **Callers covered:** all four go through `setEpicQueueBlocked`, so they're all fixed: human-merge, agent blocker, merge-wait, and the missing-issue/start-failure explanations. - **Test:** in `epicExecutionQueueJournal.test.ts`, with the clock frozen, it writes human-merge, agent blocker, human-merge, agent blocker, and then the agent blocker once more. It asserts four events, so the repeated write still adds nothing. **F7: an event in a nested transaction was announced before it was durably committed.** In `publishAfterCommit`, the activity hint is now sent only after the append's own transaction and every enclosing one up to the outermost have committed. If any of them rolls back, including the append's own savepoint, nothing is published. Knex's own `parentTransaction` link on each transaction is enough to find the enclosing ones. - **Test:** in `repositoryEventJournal.test.ts`, it covers two cases: - An inner transaction finishes with nothing published, then the outer one rolls back and still nothing is published, with no row left behind. - Inside one committed outer transaction, an inner block that rolls back isn't announced, while a sibling inner block that succeeds is. **Checks run:** - The two journal suites (20 tests) and all epic-queue suites (82 tests in total) pass. - The review-score, PR webhook and auto-merge journal suites pass. The plan-issue-status journal suite passes with `PROPR_DEMO_MODE=true`; without it, it fails on the GitHub-auth banner, which is a container issue. - `tsc --noEmit` for core passes, and ESLint with zero warnings passes on the changed source files. The ESLint config ignores the two test files, so they weren't linted. **Found separately, not changed:** `appendPullRequestOutcomeEvent` in `reviewScoreStore.ts` keys each close as `pr:N:closed:<closedAt>`. If a PR is closed, reopened and closed again within GitHub's one-second timestamp resolution, the second close would be dropped. This is a different case from F6: the key there identifies an outside webhook event so that GitHub's redeliveries are ignored, rather than standing in for a state change the code itself guards. I left it alone because it's outside F6/F7. No previews, since nothing here is visible in the UI. PR: #3496 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a durable repository journal with transactional appends, event deduplication, retention, and realtime notifications. It is merge-ready within the reviewed scope, conditional on the pending validation check completing successfully. ✅ Transactional event recording — Score, outcome, queue-transition, and plan-status writers append through their database transactions. ✅ Occurrence-aware deduplication — Head changes use delivery IDs, while repeated plan-status and blocked-reason transitions retain separate events. ✅ Focused regression coverage — Added tests cover rollback, nested transactions, redelivery, repeated transitions, and append failures. This assessment is based on static inspection of the supplied code. No commands or tests were run. The supplied current-head status reports no failures; the historical UI failure is not treated as current. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Return the persisted retention floorIn S3: 🟢 Extend coverage to PR linking
ScoreThe implementation has strong targeted coverage and no verified merge blocker within the supplied scope. Current checks show no failures, with validation still pending. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3483
Branch:
3483/claude-opus-5-5-durable-change-event-jour-20261112-1601-vhpCommits: ✅ Changes committed (111f8b6)
AI Processing Completed
Execution Details:
Summary:
The monitor that was watching the regression run has finished. Its "ALL-DONE" line is the run completing, which I already covered above: 40 of 41 files passed. The one failure was
test/planIssueManager.ultrafix.test.ts, which now passes (8/8) after I stubbed the journal module in it. Nothing else needs doing.Detailed Logs:
1cd1995a-8869-403a-8ef8-c1b635bd3f7aLog files stored at:
/usr/src/app/logs/executions/issue-3483-2026-11-12T16-39-45-160Z-conversation.json/usr/src/app/logs/executions/issue-3483-2026-11-12T16-39-45-160Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3483.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!