Skip to content

fix(automations): scope Commit & Publish to the focused run + live publish activity - #894

Open
adriandemian wants to merge 2 commits into
mainfrom
automation/publish-shortcut-run-scoping
Open

fix(automations): scope Commit & Publish to the focused run + live publish activity#894
adriandemian wants to merge 2 commits into
mainfrom
automation/publish-shortcut-run-scoping

Conversation

@adriandemian

@adriandemian adriandemian commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Re-applies two automation fixes that were never part of the extracted automation patch set on main, ported onto the current publish-shortcut architecture:
    • Commit & Publish scoped to the focused automation run — the header publish shortcut now describes the focused run conversation's own workspace instead of the automation setup workspace (useAgentsViewControlleruseAgentsWorkspaceModel threading, focusedRunWorkspaceQuery, fail-closed suppressPublishShortcut while the run workspace is unresolved).
    • Automation run publish activity refreshAgentsPublishPanel reads review/change-summary activity through useAgentPublishWorkspaceActivity with a live refetch while a run is publishing, settling when idle (useAgentWorkspacePublishLiveRefresh).

User Impact

While an automation run is focused, the Commit & Publish header shortcut and publish pane reflect that run's workspace and stay live while the run publishes — previously they could show the setup conversation's state or stale activity.

Technical Context

These originated on the skills branch (a2c2c8f20 / #846 follow-up and 4b504e98d) but were not included in the automation extraction to main; the skills branch has now dropped them so it no longer touches automation surfaces. Ports were adapted to main's evolved code: the per-conversation publish-attempt map keys by the focused run conversation, and workspacePublishMode's persisted-PR check now evaluates the focused run's workspace so setup-workspace PR state doesn't leak into the run-scoped shortcut label.

Risks / Follow-Ups

  • isPublishingWorkspace uses main's attempt-map rather than the original publishingConversationId equality (that prop no longer exists); semantics reviewed as equivalent.
  • Not included (cosmetic, optional): the skills branch also carried literal fallback values in var() colors for notice-banner, automationRunView, and the automations listing accent (var(--accent-primary, #ff6b35) style), which the extraction dropped. Worth reconsidering separately given the WKWebView longhand/fallback rule.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

When an automation run is focused, opening the publish pane, selecting
artifact tabs, or focusing a changed file no longer resets the chat focus
to the automation setup conversation, so the visible chat/agent and the
publish surface stay bound to the run conversation's workspace.

- Publish handlers in useAgentsViewController preserve automation_run
  focus and stamp publish file-focus requests with the run conversation id
- useAgentsWorkspaceModel resolves the header publish shortcut
  workspace/freshness/label from the focused run's workspace and fails
  closed (hides the shortcut) while the run workspace is unresolved
- New useAgentWorkspacePublishLiveRefresh hook polls publish queries
  (review/change-summary/diff/commits) every 2.5s while the workspace
  conversation is generating and runs one final refresh on settle
- Terminal agent events also invalidate the workspace change-summary key
- Regression tests: run-focus preservation, run-aware shortcut label,
  fail-closed suppression, two-run publish scope leakage, polling lifecycle
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.93671% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ponents/agents/useAgentPublishWorkspaceActivity.ts 87.50% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

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