Skip to content

Drive ReviewMonitor reviews through CodexKit#78

Merged
lynnswap merged 371 commits into
mainfrom
codex/review-run-data-flow
Jul 4, 2026
Merged

Drive ReviewMonitor reviews through CodexKit#78
lynnswap merged 371 commits into
mainfrom
codex/review-run-data-flow

Conversation

@lynnswap

@lynnswap lynnswap commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Purpose

Rebuild ReviewMonitor's review data flow on CodexKit. The legacy in-repo app-server wire/domain stack (CodexReviewDomain, CodexReviewApplication, CodexReviewAppServerWire, CodexReviewMCPAdapter) is replaced by CodexAppServerKit/CodexDataKit from lynnswap/CodexKit#16, with the UI driven by observable DataKit models.

Changes

  • Review runtime: CodexReviewAppServer backend drives reviews through CodexAppServerKit (detached review sessions, thread event generations, model-actor-owned DataKit context). Runtime teardown now always releases the UI model source through one boundary (clearAppServerModelContainer).
  • Sidebar / detail UI: chat rows and the detail log render from CodexDataKit fetched results and chat observations (ReviewMonitorCodexModelSource, ReviewMonitorCodexChatLogTarget). Chat log re-observation is serialized across selection changes and observation errors are surfaced instead of swallowed.
  • Chat log rendering: new ReviewChatLogUI renderer/projection pipeline (revision-gated incremental updates, per-chat scroll restoration, command output panels with live duration).
  • MCP server: review tool results carry the stored final review even without a log projection, review_read requires runId in its schema to match the handler, and detailed reads return a bounded 100-item tail page with honest paging metadata.
  • Dependency: CodexKit is pinned to the reviewed main revision 6de9e01 (no tagged releases yet), replacing the temporary local path reference.
  • Tests: consumer-facing behavior is covered by ReviewUITests/CodexReviewMCPServerTests additions; command-output-panel block id helpers now include the item kind segment (<turnID>:<kind>:<itemID>), fixing five stale click-by-block-id expectations.

Validation

  • swift test --build-system swiftbuild --no-parallel — 378 tests, all passing
  • xcodebuild test -project Tools/ReviewMonitor/CodexReviewMonitor.xcodeproj -scheme CodexReviewMonitor -destination 'platform=macOS,arch=arm64' — 15 tests, all passing
  • Codex branch-wide review against main (3156c4c): three rounds; final round reports no findings (rounds 1–2 findings fixed in d61a345 and 8d47d91)
  • Manual: duplicate review-log rendering and the stuck command count-up reported during integration were traced to CodexKit turn/marker identity and fixed upstream in Integrate CodexDataKit model actor and chat lifecycle APIs CodexKit#16

🤖 Generated with Claude Code

lynnswap added 30 commits June 27, 2026 21:43

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

liveStoreCompletesBrowserLoginFromAccountNotifications synchronized only on
the account update, so on slow CI runners the trailing
account/rateLimits/read request could be missing from the asserted
sequence. Wait for the full request count first, matching the sibling
add-account test that already synchronizes through the refresh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lynnswap

lynnswap commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

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

ℹ️ 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 Sources/CodexReviewAppServer/AppServerCodexReviewBackend.swift
Comment thread Sources/ReviewUI/Sidebar/CodexChats/ReviewMonitorCodexSidebarOutline.swift Outdated
Comment thread Sources/CodexReviewKit/Store/CodexReviewStoreReviews.swift Outdated
Comment thread Sources/CodexReviewKit/Store/CodexReviewStoreOrderQueries.swift Outdated
lynnswap and others added 4 commits July 3, 2026 22:26
The first workspace-group drag operated on an empty preferred-order array,
so the reorder could not place the dragged group relative to the target;
carry the currently displayed root order through the resolved drop and
merge it before reordering, mirroring the chat reorder path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The bounded startReview overload lacked the cancellation handler the
unbounded path has, so MCP clients disconnecting mid-wait orphaned the
active worker. Timeouts still return with the worker running.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pendingReviewCancellation advertised an enabled capability with no action,
leaving a clickable no-op Cancel menu item; the pending state is now
visible but disabled, and the context-menu test pins the disabled state.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CodexAppServerKit's loginChatGPT cannot yet forward the native
web-authentication callback scheme to account/login/start, so the
challenge must not be marked native; record why until the CodexKit API
exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

@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: 9be9a6539d

ℹ️ 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 Package.swift
Comment thread Sources/ReviewUI/Sidebar/CodexChats/ReviewMonitorCodexSidebarOutline.swift Outdated
Comment thread Sources/CodexReviewMCPServer/CodexReviewMCPToolResults.swift Outdated
lynnswap and others added 5 commits July 3, 2026 23:05
The CodexReview scheme still referenced CodexReviewTests (renamed to
CodexReviewKitTests) and the deleted ArchitectureFenceTests, so Xcode and
xcodebuild -scheme CodexReview test hit unresolved testables.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Listed chats frequently omit status; the latest-finished scan skipped them,
hiding completed chats unless the backend supplied an explicit idle status.
Classify finished as not-actively-running, matching the rest of the sidebar.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
orderedEntryIds/activeEntryIds still serialized every projected entry, so
detailed review_read responses kept scaling with the full transcript
despite the 100-item tail page; filter both arrays to the returned window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime-home fallback ignored CODEX_HOME, starting the app-server
against HOME/.codex_review for users and CI that isolate homes with the
environment variable; honor it first, matching the pre-migration
AppServerCodexHome.url order. Account registries written before the kind
field also failed to decode wholesale, dropping persisted accounts;
restore the decodeIfPresent + legacyDefault behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
structuredContent still built finalReview/hasFinalReview/reviewResult from
core.finalReview alone, so clients consuming structured results saw a
terminal review with finalReview: null whenever only the CodexChat log
projection held the final review; pass the resolved value from the read
path, matching the text content.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

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

ℹ️ 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 Sources/ReviewChatLogUI/ReviewMonitorCodexChatLogTarget.swift
Switching chats intentionally keeps the previous transcript on screen
until the next baseline renders (anti-flash, pinned by test), but when the
new observation throws no baseline ever arrives and another chat's log
stayed visible indefinitely; clear the pane in the failure path while the
failed chat is still bound.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Provided git ref 4cee5f307eda007dbd34835d59bb04340d5dda28 does not exist
ℹ️ 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".

@lynnswap

lynnswap commented Jul 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@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: 4cee5f307e

ℹ️ 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 Sources/ReviewUI/Sidebar/CodexChats/ReviewMonitorSidebarViewController.swift Outdated
Dragging a group while a chat filter was active passed only the visible
roots as the current order, so hidden groups were dropped from the
remembered order and moved when the filter cleared. Use the unfiltered
source-section group order and map end-of-visible-list drops to the next
unfiltered group, mirroring the chat reorder path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

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

ℹ️ 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 Sources/CodexReviewMCPServer/ReviewMCPLogProjection.swift
Comment thread Sources/CodexReviewMCPServer/ReviewMCPLogProjection.swift
The final MCP result took the last message item regardless of role, so a
trailing user prompt could replace the review findings; only agent
messages qualify now, with the existing core.finalReview fallback covering
transcripts without one. Item revisions also digested only the text length,
hiding same-length edits from clients that compare log.revision; digest
the content instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@lynnswap lynnswap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex review

@lynnswap lynnswap merged commit 52433ac into main Jul 4, 2026
1 check passed
@lynnswap lynnswap deleted the codex/review-run-data-flow branch July 4, 2026 04:01

@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: 51b27e1065

ℹ️ 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 197 to +200
if let session = unregisterReviewEventSession(for: run) {
await session.abandon()
let metrics = await session.metricsSnapshot()
for threadID in await session.cleanupThreadIDs() {
for threadID in localCleanupThreadIDs(for: run, additional: await session.cleanupThreadIDs()) {

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 Preserve abandoned restart threads for later cleanup

When a network recovery restart succeeds but the restarted review gets a different reviewThreadID than the interrupted attempt, this branch unregisters and abandons the old session without carrying its cleanupThreadIDs into any deferred cleanup. The normal terminal cleanupReview later runs only for the recovered attempt, so the interrupted review thread is never passed to cleanupAppServerReview/thread/delete and can remain as a stale chat until the app-server exits. Please store these cleanup IDs with the restart token or merge them into the recovered attempt’s cleanup path.

Useful? React with 👍 / 👎.

Comment on lines +328 to 331
return ReviewMonitorWindowController(
appStore: dependencies.store,
codexModelSource: codexModelSource,
showSettings: showSettings

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 Use the existing window-controller initializer

In the non-preview launch path this calls ReviewMonitorWindowController with an appStore: label, but the class only defines overloads taking store: (including store:codexModelSource:showSettings:). As written, the ReviewMonitor app target cannot compile once this branch is selected; switch this call to the existing store: label.

Useful? React with 👍 / 👎.

Comment on lines 846 to 850
auth: auth,
activation: activation
)
await closeIsolatedLoginRuntime(client: loginClient, codexHomeURL: loginCodexHomeURL)
await closeIsolatedLoginRuntime(appServer: loginAppServer, codexHomeURL: loginCodexHomeURL)
return

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 Allow isolated add-account login while runtime is down

When a user has an existing account and chooses Add Account while the primary review runtime is stopped or failed, loginRuntime(for: .preserveActiveAccount) has already created a temporary app-server backend, but this guard still rejects the flow because self.appServerBackend is nil and reports “Review runtime is not running.” The account sidebar and Add Account control remain available in unavailable runtime states, so this blocks the isolated login path exactly when it should let users add or refresh accounts without starting the main runtime.

Useful? React with 👍 / 👎.

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