Commit Graph

155 Commits

Author SHA1 Message Date
Ashish Huddar e30e5dbf08 feat(web): add global not-found.tsx for 404 handling
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 20:40:39 +05:30
Ashish Huddar d5966c528a feat(web): add session loading.tsx with spinner for route transitions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 20:39:35 +05:30
Ashish Huddar 49817315bf feat(web): add global loading.tsx with spinner for route transitions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 20:38:23 +05:30
Harsh Batheja 34bc5bb2d5
feat: support multiple concurrent orchestrators with isolated worktrees (#870)
* feat: support multiple concurrent orchestrators with isolated worktrees

- Each orchestrator session gets a numbered ID ({prefix}-orchestrator-N)
  and an isolated git worktree, replacing the single shared orchestrator
- reserveNextOrchestratorIdentity atomically reserves the next available
  number and detects conflicting project prefix configurations early
- isOrchestratorSession / isOrchestratorSessionName accept optional
  allSessionPrefixes for cross-project false-positive prevention
- getProjectPause and resolveGlobalPause track the longest active pause
  across all concurrent orchestrators instead of returning the first found
- cleanupWorktreeAndMetadata helper used consistently on all failure paths
  including post-launch; system prompt file included in cleanup
- pollBacklog, status.ts, ProjectSidebar, sessions page, global-pause,
  project-utils, serialize, and sessions API route all pass
  allSessionPrefixes to isOrchestratorSession
- Web sessions/[id]/page.tsx fetches project prefix map and passes it
  through prefixByProjectRef to avoid stale closure in fetchProjectSessions

* fix: seed sseAttentionLevels from fresh sessions on full refresh

When scheduleRefresh dispatches a reset action, derive sseAttentionLevels
from the freshly fetched sessions using getAttentionLevel. This clears
phantom entries for removed sessions and seeds correct levels for new
sessions, preventing stale favicon color and attention counts until the
next SSE snapshot.

* fix: merge duplicate @/lib/types imports into single import statement

Combining the separate import type and value import from @/lib/types
into one import to satisfy the no-duplicate-imports lint rule.
2026-04-04 12:30:51 +05:30
harshitsinghbhandari ddba72a485 Merge branch 'main' of https://github.com/ComposioHQ/agent-orchestrator into feat/736 2026-04-03 02:40:53 +05:30
Harsh Batheja 661a30978f
feat: event-driven live tab titles and favicons via SSE (#848)
* feat: event-driven live tab titles and favicons via SSE

Switch tab titles and favicons from polling to real-time SSE updates:

- Extend useSessionEvents to expose sseAttentionLevels map from SSE
  snapshots (server-computed, includes full PR state)
- Refactor DynamicFavicon to use SSE attention levels instead of
  recomputing from the full sessions array (which has stale PR data
  between refreshes)
- Add useSSESessionActivity hook for session detail page to update
  document.title emoji immediately on activity change
- Add live dashboard title showing count of sessions needing attention
- Update PullRequestsPage to use new DynamicFavicon API

Closes #115

* fix: seed initial attention levels to avoid stale favicon/title on first render

Accept initialAttentionLevels parameter in useSessionEvents so callers
can seed the attention map from initialSessions via getAttentionLevel().
This prevents the favicon and dashboard title from briefly showing
"all clear" before the first SSE snapshot arrives.

* fix: add EventSource mock to session page test for SSE hook compatibility

* fix: reset stale activity state when sessionId changes in useSSESessionActivity

Add sessionId to the effect dependency array and reset state to null at
the start of each effect run so callers that reuse the hook with a
different sessionId don't see the previous session's activity.

* fix: reset sseAttentionLevels on initialSessions change to prevent stale data on project switch

The reset action now accepts an optional sseAttentionLevels field. When
initialSessions changes (e.g., project switch via sidebar), the dispatch
passes the current initialAttentionLevels via ref so the favicon and
dashboard title reflect the new project immediately rather than showing
stale attention data until the first SSE snapshot.
2026-04-03 02:36:26 +05:30
harshitsinghbhandari add74f1a46 fix: handle optional plugin field in CLI and web packages
Update all usages of project.tracker.plugin and project.scm.plugin
to use optional chaining since the plugin field is now optional
when package or path fields are specified.

Files updated:
- CLI: doctor.ts, status.ts, verify.ts
- Web: issues/route.ts, verify/route.ts, scm-webhooks.ts,
       serialize.ts, services.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 19:19:44 +05:30
Tanuu 5d0142fd03 fix: return 400 for invalid verify API payloads 2026-04-02 16:39:44 +05:30
Harsh Batheja 53ef778357
feat: add CI failure detail notifications in lifecycle manager (#850)
* feat: add CI failure detail notifications in lifecycle manager

When CI fails on a PR, the lifecycle manager now fetches individual check
details (names, statuses, URLs) and sends them to the worker session.
This complements the existing static reaction message with actionable
debugging information.

Flow:
- On first transition to ci_failed: static reaction message fires (existing)
- On next poll: detailed CI failure info with check names and URLs dispatched
- Fingerprinting prevents re-sending the same failure set
- New/changed failures trigger fresh detailed notifications
- Tracking metadata cleared when PR is merged/closed or CI passes

Follows the same deduplication pattern as maybeDispatchReviewBacklog().

* fix: send CI details directly to avoid consuming reaction retry budget

The detailed CI failure dispatch now uses sessionManager.send() directly
instead of executeReaction(), so it doesn't increment the ci-failed
reaction tracker. This prevents low retries/escalateAfter settings from
causing premature escalation before the agent receives failure details.

The transition reaction still owns escalation; the detailed dispatch is
purely informational follow-up delivery.

* feat: add merge conflict notifications in lifecycle manager

Adds maybeDispatchMergeConflicts() that detects merge conflicts from
the PR enrichment cache or getMergeability() and notifies the worker
session. Conflicts are dispatched independently of session status since
they can coexist with ci_failed, changes_requested, etc.

- Uses the existing merge-conflicts reaction config
- Dispatches once per conflict occurrence (tracks lastMergeConflictDispatched)
- Clears tracking when conflicts resolve, allowing re-dispatch if they recur
- Sends directly via sessionManager.send() (same pattern as CI details)

* fix: use CICheck type instead of inline type declaration

Replace inline Array<{ name, status, url, conclusion }> with the
existing CICheck type from ./types.js for formatCIFailureMessage and
the checks variable in maybeDispatchCIFailureDetails.

* fix: resolve no-useless-assignment lint error in merge conflict check

Declare hasConflicts without initial value since both branches of the
if/else assign to it before it's read.

* feat: show agent notification state in session page blockers

The blockers section on both SessionDetail (IssuesList) and SessionCard
(alert pills) now shows whether the agent has been notified about each
blocker. Reads lifecycle manager dispatch metadata:
- lastCIFailureDispatchHash for CI failures
- lastMergeConflictDispatched for merge conflicts
- lastPendingReviewDispatchHash for review comments

Displays "agent notified" indicator next to blockers where the lifecycle
manager has already forwarded the issue to the worker session.

* fix: use lifecycle status as fallback for blockers when PR data is stale

The blockers section now uses the lifecycle manager's session status
metadata as a source of truth when PR enrichment data hasn't caught up.
PR enrichment uses a 5-min cache and can timeout or be rate-limited,
causing blockers to show stale/incorrect state.

Changes:
- IssuesList and getAlerts now check metadata["status"] (lifecycle
  manager state) alongside PR enrichment data
- CI failing: shown when pr.ciStatus is "failing" OR lifecycle status
  is "ci_failed"
- Changes requested: shown when pr.reviewDecision matches OR lifecycle
  status is "changes_requested"
- Merge conflicts: shown when pr.mergeability.noConflicts is false OR
  lifecycle dispatch metadata indicates conflicts were detected

* fix: fall back to getMergeability when cached hasConflicts is undefined

When PREnrichmentData has hasConflicts as undefined (the field is typed
as boolean | undefined), the previous check treated it as no conflicts.
Now falls through to the getMergeability() call instead.

* test: add coverage for CI/conflict notify action and recovery paths

- Test CI tracking clears when CI recovers to passing
- Test notify action for CI failure details (human notification path)
- Test notify action for merge conflicts (human notification path)

These cover the previously uncovered notify action branches and the
CI recovery cleanup path in the lifecycle manager.

* fix: resolve typecheck error in CI recovery test

writeMetadata requires SessionMetadata type which doesn't include
custom keys like lastCIFailureFingerprint. Rewrote the test to use
setupCheck and let the lifecycle manager set tracking metadata
naturally through the CI failure flow, then verify cleanup on recovery.

* fix: don't use dispatch metadata for conflict detection in UI

lastMergeConflictDispatched lingers after conflicts resolve until the
lifecycle manager's next poll clears it. Using it as a conflict signal
caused stale "merge conflict" alerts. Now only pr.mergeability.noConflicts
drives conflict detection; the metadata is only used for the "agent
notified" badge.

* fix: use Promise.allSettled for dispatch functions to avoid orphaned rejections

Promise.all rejects immediately on first failure, leaving in-flight
promises unmonitored. Promise.allSettled waits for all to complete.
2026-04-02 11:23:08 +05:30
Ashish Huddar eb5bc34ff7 Stabilize SessionCard quick reply test 2026-04-01 20:19:57 +05:30
Ashish Huddar e1d0a04b09 Fix lint error in terminal test 2026-04-01 20:13:17 +05:30
Ashish Huddar b749ab3e50 Add coverage for terminal UI changes 2026-04-01 19:52:55 +05:30
Ashish Huddar 108dd7aa50 Address terminal theme review comments 2026-04-01 19:43:35 +05:30
Ashish Huddar 9470befabf Fix DirectTerminal theme test 2026-04-01 19:29:10 +05:30
Ashish Huddar a4e8c7f360 Merge remote-tracking branch 'origin/main' into ashish921998/design-sync-pr 2026-04-01 18:52:11 +05:30
Dhruv Sharma b611222d87
Merge pull request #730 from ruskaruma/fix/parallel-pr-enrichment
perf(web): parallelize PR enrichment in GET /api/sessions
2026-03-30 14:30:54 +05:30
suraj_markup f73aebe634
Merge pull request #761 from suraj-markup/fix-runtime-terminal-projectid-hardening
fix(web): runtime terminal port resolution + project-id hardening
2026-03-29 14:50:25 +05:30
Ashish Huddar ce4927543a Align web UI to design system 2026-03-29 09:23:17 +05:30
suraj-markup f82e4e6ad9 fix(test): replace dynamic delete with Reflect.deleteProperty in withEnv
Fixes @typescript-eslint/no-dynamic-delete lint error in api-routes.test.ts
which was breaking Lint, Typecheck, and the onboarding build check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 03:58:38 +05:30
suraj-markup 717253cf8e fix(web): harden project validation, fetch timeout, and test coverage
- centralize project existence check via validateConfiguredProject
  (Object.hasOwn) and apply to spawn, issues, verify, orchestrators routes
- add AbortController (1.5s) to runtime terminal config fetch in DirectTerminal
- add runtimeFetchDone flag to prevent repeated fetches on reconnect
- restore resolveDashboardProjectFilter fallback to getPrimaryProjectId()
- expand runtime terminal endpoint tests (defaults, invalid ports, proxy path)
- add validation.test.ts covering prototype-chain bypass cases
- add undefined case test for resolveDashboardProjectFilter
- update changeset with full list of changes for npm publish

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 03:17:42 +05:30
Ashish Huddar 8d16049222 fix: correct mismatched status colors after light/dark token swap
- Light mode --color-status-ready: #5B7EF8 → #5e6ad2 (DESIGN.md specifies darker shade for light backgrounds)
- Light mode --color-tint-red: rgba(207,34,46,...) → rgba(220,38,38,...) to match new #dc2626
- Dark mode --color-tint-red: rgba(255,123,114,...) → rgba(239,68,68,...) to match new #ef4444
- ActivityDot.tsx: update hardcoded bg tints — active gets green rgba(34,197,94,0.1), ready gets blue rgba(91,126,248,0.1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 00:42:34 +05:30
Ashish Huddar f4ba0fb64d implement design system: Geist Sans, new accent tokens, GPU-composited dot pulse
- Replace IBM Plex Sans/Mono with Geist Sans (keep JetBrains Mono)
- Update accent: #5e6ad2 → #5B7EF8 (blue), add amber respond/cyan review status tokens
- Update status colors: working=green #22c55e, ready=blue #5B7EF8, error=red #ef4444
- Add --radius-base: 2px; apply 2px border-radius to session cards and orchestrator buttons
- Replace box-shadow activity-pulse with GPU-composited dot-ring pseudo-element (.dot-pulse)
- Remove ready-rail-breathe and ready-sheen keyframes (decorative anxiety, high perf cost)
- Update card entrance: slide-up uses 8px translateY and spring easing cubic-bezier(0.16,1,0.3,1)
- Cap nav backdrop-filter at blur(12px)
- Add contain: layout style paint to session cards
- Pulse animation min-opacity 0.4→0.6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 00:10:28 +05:30
suraj-markup 5315e4e0ab fix(web): runtime terminal port resolution + project-id hardening 2026-03-28 19:23:15 +05:30
ruskaruma e58117a9d0 address reviews 2026-03-27 08:56:21 +05:30
ruskaruma a17053bf2d test(web): add concurrency test for parallel PR enrichment (#729) 2026-03-27 08:13:21 +05:30
ruskaruma 41651164e7 perf(web): parallelize PR enrichment in GET /api/sessions(fixes #729) 2026-03-27 03:52:42 +05:30
Ashish Huddar c32fb6a03c Fix session polling and BottomSheet freshness 2026-03-27 01:38:54 +05:30
Ashish Huddar 8ce7366b82 Import useRef for session detail page 2026-03-27 01:34:13 +05:30
Ashish Huddar ada469556a Fix session detail project polling and orchestrator response 2026-03-27 01:27:38 +05:30
Ashish Huddar c008c3c4c2 Refresh bottom sheet session data and update tests 2026-03-27 00:32:52 +05:30
Ashish Huddar 24a293d811 Handle send errors and stabilize script tests 2026-03-27 00:25:10 +05:30
Ashish Huddar 5b1f3625a5 Reset mobile view-all state and surface send errors 2026-03-26 23:37:51 +05:30
Ashish Huddar 4a842d4742 Fix ao launcher linking and mobile toast offset 2026-03-26 22:47:25 +05:30
Ashish Huddar e1867d0bef Preserve orchestrator ID when session project changes 2026-03-26 22:38:30 +05:30
Ashish Huddar 128c9101c8 Handle dashboard send failures and optimize session polling 2026-03-26 22:28:31 +05:30
Ashish Huddar b69cb9aac2 Guard alert action sends and reset on failure 2026-03-26 11:34:13 +05:30
Ashish Huddar 16c2bf23d1 Fix quick reply success state on send failures 2026-03-26 11:22:50 +05:30
Ashish Huddar 82a93a0a2b Fix metadata loading and refresh orchestrator session links 2026-03-26 11:12:55 +05:30
Ashish Huddar 5de48bb3f0 Restore desktop confirm flow and rename session PR card 2026-03-26 10:57:51 +05:30
Ashish Huddar 618448e620 Fix mobile session row grid for 44px open button 2026-03-26 09:07:08 +05:30
Ashish Huddar fa37074a3f Show desktop quick replies and stabilize session polling 2026-03-26 08:30:22 +05:30
Ashish Huddar c38a282f29 Improve mobile nav and reduce session detail polling 2026-03-26 02:03:50 +05:30
Ashish Huddar 771453e088 Prevent stale sheet state and duplicate quick replies 2026-03-26 01:47:14 +05:30
Ashish Huddar 05ede816ca Preserve collapsed mobile accordion state across updates 2026-03-25 18:28:33 +05:30
Ashish Huddar fd742b595a Keep pull request stat cards visible on mobile 2026-03-25 14:55:09 +05:30
Ashish Huddar 1fb01f99fc Normalize dashboard project filtering and align session layout 2026-03-25 14:34:55 +05:30
Ashish Huddar da543960b7 Fix web imports for service worker and project utils 2026-03-25 14:08:54 +05:30
Ashish Huddar d743a196d3 Polish mobile dashboard UX and harden PWA behavior 2026-03-25 13:57:40 +05:30
Ashish Huddar 740933e0a0 Fix mobile dashboard seeding and remove unsafe assertions 2026-03-25 11:45:12 +05:30
Ashish Huddar b8eab07d28 Fix mobile dashboard navigation and connection state handling 2026-03-25 11:41:36 +05:30