Skip to content

feat(extensions): add review reload requests - #988

Merged
benvinegar merged 1 commit into
mainfrom
feat/extension-review-reload
Sep 5, 2026
Merged

feat(extensions): add review reload requests#988
benvinegar merged 1 commit into
mainfrom
feat/extension-review-reload

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Problem

Extensions backed by external agent or service streams can know when file edits finish, but they cannot await Hunk rebuilding the mounted review unless watch mode happens to observe the write. Dispatching hunk.app.refresh only reports command acceptance and hides reload refusal or failure.

Solution

  • Add API v18 ctx.review.requestReload() to lifecycle and custom-event contexts.
  • Return explicit ok, unavailable, and failed results and publish successful reloads with session_reload.reason === "extension".
  • Keep reload ownership in AppHost: same-generation extension requests coalesce, all reload sources share the existing FIFO coordinator, and the current descriptor is resolved only when queued work begins.
  • Lease controls to their review generation while allowing successor lifecycle handlers to schedule a trailing reload.
  • Reuse the existing soft-reload path, preserving mounted UI state and semantic selection where possible.

This does not expose arbitrary inputs, extension-registry reloads, or remote/session authority.

Verification

  • bun run format:check
  • bun run lint
  • bun run typecheck
  • bun run deps:check
  • bun run check:docs
  • bun run check:pack
  • bun run changeset:status
  • bun run test (2,000 tests, 1,998 passed, 2 skipped)
  • bun run test:integration (144 tests, 143 passed, 1 macOS-only skip)
  • bun run test:tty-smoke (9 passed)
  • Final targeted PTY: agent edit reloads without --watch

Tested on Linux. No visual UI change, so visual evidence is not applicable.

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hunk-web Ready Ready Preview Sep 5, 2026 2:15am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds API v18 review-reload controls for extension lifecycle and custom-event handlers. It:

  • Introduces explicit successful, unavailable, and failed reload results.
  • Leases controls to review generations while permitting successor handlers to enqueue trailing work.
  • Coalesces same-generation extension requests and serializes them with existing reload sources.
  • Publishes successful requests through session_reload with reason extension.
  • Adds unit, host-integration, PTY, API, and documentation coverage.
  • Requires one filename adjustment to satisfy the repository’s enforced TypeScript naming convention.

Confidence Score: 4/5

The reload behavior appears sound, but the repository’s enforced filename convention must be satisfied before merging.

The queueing, generation leasing, result handling, and lifecycle publication are coherently implemented and tested; the only accepted issue is the new camelCase TypeScript filename.

Files Needing Attention: src/ui/lib/extensionReviewReload.ts

Important Files Changed

Filename Overview
src/ui/AppHost.tsx Adds generation-aware coalescing and host-queue execution for extension-requested soft reloads.
src/ui/App.tsx Creates leased review-reload controls and supplies them to extension event contexts.
src/ui/hooks/useExtensionEventContextProvider.ts Installs review-reload controls alongside existing pane, navigation, and dialog capabilities.
src/ui/lib/extensionReviewReload.ts Implements lease-guarded reload controls correctly, but its filename violates the required dash-case convention.
src/extension-api/types.ts Advances the extension API to v18 and defines reload controls, result variants, and the new lifecycle reason.
src/ui/AppHost.extensions.test.tsx Covers unavailable and failed results, coalescing, lease expiration, successor requests, lifecycle publication, and queue ordering.

Sequence Diagram

sequenceDiagram
  participant E as Extension handler
  participant L as Generation lease
  participant H as AppHost reload queue
  participant D as Current review descriptor
  participant A as Mounted App
  E->>L: ctx.review.requestReload()
  alt Lease expired
    L-->>E: unavailable
  else Lease live
    L->>H: enqueue/coalesce request
    H->>D: Resolve descriptor when work begins
    alt Input is not reloadable
      H-->>E: unavailable
    else Reload fails
      H->>A: Soft reload
      H-->>E: failed with detail
    else Reload commits
      H->>A: Soft reload current input
      A-->>H: Successor mounted
      H->>E: "session_reload(reason="extension")"
      H-->>E: ok
    end
  end
Loading
Prompt To Fix All With AI
### Issue 1
src/ui/lib/extensionReviewReload.ts:15
**Filename Violates Naming Convention**

The new `extensionReviewReload.ts` file uses camelCase, but the repository’s Oxlint-enforced `unicorn/filename-case` directive requires dash-case for TypeScript files. Rename it to `extension-review-reload.ts` and update its imports. This repository requirement must be satisfied before merging.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(extensions): add review reload requ..." | Re-trigger Greptile

});

/** Guard one host-owned reload operation behind a review-generation capability lease. */
export function createExtensionReviewReloadControls({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Filename Violates Naming Convention

The new extensionReviewReload.ts file uses camelCase, but the repository’s Oxlint-enforced unicorn/filename-case directive requires dash-case for TypeScript files. Rename it to extension-review-reload.ts and update its imports. This repository requirement must be satisfied before merging.

Context Used: guidelines.mdc Cursor rule (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ui/lib/extensionReviewReload.ts
Line: 15

Comment:
**Filename Violates Naming Convention**

The new `extensionReviewReload.ts` file uses camelCase, but the repository’s Oxlint-enforced `unicorn/filename-case` directive requires dash-case for TypeScript files. Rename it to `extension-review-reload.ts` and update its imports. This repository requirement must be satisfied before merging.

**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@benvinegar
benvinegar merged commit 622c0a3 into main Sep 5, 2026
13 checks passed
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