Skip to content

feat: add controlled browser preview workflow - #3207

Open
nikhilachale wants to merge 27 commits into
mainfrom
ao/dev/agent-orchestrator-142/browser-preview-live-reload-pr
Open

feat: add controlled browser preview workflow#3207
nikhilachale wants to merge 27 commits into
mainfrom
ao/dev/agent-orchestrator-142/browser-preview-live-reload-pr

Conversation

@nikhilachale

@nikhilachale nikhilachale commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep Browser closed by default and treat URLs printed in terminal output as signal-only, showing the Browser indicator without navigating or stealing focus
  • preserve explicit terminal-link navigation while safely serializing and coalescing preview requests
  • open web links in AO Browser only for active workers; standalone shell, orchestrator, and terminated-session links continue to use the system browser
  • extend the terminal-link context menu with Open in system browser and Copy link actions
  • refresh explicitly selected static HTML, Markdown, and related assets only after worker activity becomes idle, waits for input, or exits
  • never choose a preview target for a fresh worker; selection remains owned by ao preview, a managed preview server, or deliberate user navigation
  • avoid replayed terminal output opening live previews
  • document the rendered-preview workflow for framework projects: use the exact session worktree, start or reuse its development server, wait for a healthy URL, and run ao preview <url> near the end of UI work
  • add an explicit Browser toolbar action for opening the current page externally
  • merge current main and resolve the preview poller and Browser panel conflicts

Review fixes

  • guard every poller target mutation and refresh with a URL + target-revision compare-and-set so a stale session snapshot cannot overwrite an explicit user selection
  • persist the exact revision produced by a poller-owned missing-file clear, and restore only while the blank target still has that revision
  • separate explicit target revisions from static-content refresh revisions; automatic refreshes now reload the Browser's current location instead of navigating back to the selected entrypoint
  • replace the per-session 250 ms recursive asset walk with a complete, uncapped fingerprint at a five-second cadence while retaining cheap entry metadata checks on each poll
  • preserve current main's explicit-preview ownership instead of reintroducing automatic entrypoint discovery
  • restore system-browser fallback for terminals that do not have an AO Browser inspector
  • route the Browser toolbar's external action through the shared error-handling policy
  • remove a stale Browser layout wrapper left over from the retired viewport selector

Tests

  • npm run lint (full backend tests + golangci-lint)
  • cd backend && go test -race ./internal/preview ./internal/service/session ./internal/storage/sqlite/store
  • cd frontend && npm test
  • cd frontend && npm run typecheck
  • regenerated and verified sqlc, OpenAPI, and frontend API artifacts with the repository-pinned generators

Notes

  • framework applications still require their project development server; worker guidance selects the relevant route and invokes ao preview
  • static file previews are daemon-driven after explicit selection and refreshed only when active worker activity finishes

@nikhilachale
nikhilachale marked this pull request as draft July 28, 2026 10:06
@nikhilachale nikhilachale changed the title feat: auto-preview live links and reload static UI feat: add controlled browser preview workflow Jul 28, 2026
@nikhilachale
nikhilachale marked this pull request as ready for review July 28, 2026 20:11
@nikhilachale
nikhilachale requested a review from Pulkit7070 July 29, 2026 22:51
@nikhilachale
nikhilachale requested a review from illegalcall July 30, 2026 02:18
@nikhilachale
nikhilachale requested a review from whoisasx July 30, 2026 09:12

@whoisasx whoisasx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes for four correctness and scalability issues in preview ownership and refresh handling. The controlled terminal-link workflow, fresh-worker behavior, external-open support, and prompt/documentation changes otherwise look coherent. Focused backend/frontend tests, race tests, typecheck, and CI pass, but focused regression probes reproduced the ownership failures described inline.

Comment thread backend/internal/preview/poller.go
Comment thread backend/internal/preview/poller.go
Comment thread backend/internal/preview/tree_state.go
Comment thread backend/internal/preview/poller.go
@i-trytoohard i-trytoohard added comp/desktop Electron main process and React renderer. enhancement New feature or request labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron main process and React renderer. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants