feat: shareable task-page deep links in commits and reviews#77
feat: shareable task-page deep links in commits and reviews#77fshehadeh-sfl wants to merge 9 commits into
Conversation
Introduce an optional PUBLIC_BASE_URL setting (blank-string-safe, validated as a URL) plus buildTaskPageUrl / resolvePublicBaseUrl helpers. These produce shareable hash-routed deep links of the form <base>/#/tasks/<id> used by later commits to link commits and review summaries back to a task's admin page. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Thread the resolved task-page URL from OrchestratorConfig through the agent session and into the container as VE_TASK_PAGE_URL. The agent-worker now appends a deterministic `Virtual-Engineer: <url>` footer alongside the Change-Id when rewriting agent commits, so every commit VE produces links back to its task page. The trailer injection is idempotent and provider-agnostic (Gerrit, GitLab, GitHub), reusing the existing rebase-based footer rewrite. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Append a `— Reviewed by Virtual Engineer: <url>` line to the posted review summary (and vote message) when a public base URL is configured. The raw summary is preserved for the persisted cycle record; only the posted copy carries the link, and it is added idempotently. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add hash-based routing to the admin SPA so each task is reachable at `#/tasks/<id>` (with browser back/forward support). The selected task is now driven by the URL, and TaskDetail gains a copy-link button that yields a shareable URL, preferring the configured public base URL and falling back to the current origin. The public base URL is surfaced to the client via the dashboard bootstrap. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve the public base URL once in the composition root and pass it into the orchestrator config, review orchestrator deps, and admin runtime config so commit trailers, review summaries, and the dashboard bootstrap all share the same resolved value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds shareable, deep-linkable task pages to the admin UI and propagates those links into the artifacts Virtual Engineer generates (agent commits and review summaries), backed by a new PUBLIC_BASE_URL config used to build stable external URLs.
Changes:
- Introduces hash-based routing for the admin SPA (
#/tasks/<id>) plus a copy-link control on the task detail page. - Adds a shared URL builder/resolver (
buildTaskPageUrl,resolvePublicBaseUrl) and threads the resulting task-page URL through orchestrator/review flows. - Injects deterministic commit-message trailers in the agent-worker (
Virtual-Engineer: <url>alongsideChange-Id) and appends task links to posted review summaries.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/taskPageUrl.test.ts | Adds unit tests for task-page URL building and base-URL resolution. |
| tests/unit/reviewOrchestrator.test.ts | Adds coverage around appending task-page links to review summaries/votes. |
| tests/unit/orchestrator.test.ts | Updates orchestrator test config to include publicBaseUrl. |
| tests/unit/orchestrator.projectMode.test.ts | Updates project-mode orchestrator test config to include publicBaseUrl. |
| tests/unit/orchestrator.concurrency.test.ts | Updates concurrency orchestrator test config to include publicBaseUrl. |
| tests/unit/dashboard.test.ts | Ensures dashboard bootstrap JSON includes publicBaseUrl. |
| tests/unit/copilotAdapter.test.ts | Verifies VE_TASK_PAGE_URL env injection into the agent container. |
| src/utils/taskPageUrl.ts | New helper functions for building task deep links and resolving the external base URL. |
| src/review/reviewOrchestrator.ts | Appends a task-page link to posted review summaries when configured. |
| src/orchestrator/orchestrator.ts | Threads task-page URL into the agent session so the worker can inject commit trailers. |
| src/interfaces.ts | Extends AgentSession with taskPageUrl. |
| src/index.ts | Resolves and wires publicBaseUrl into orchestrator, review orchestrator, and admin bootstrap. |
| src/config.ts | Adds PUBLIC_BASE_URL env var and schema validation. |
| src/agents/copilotAdapter.ts | Passes VE_TASK_PAGE_URL into the agent container env when present. |
| src/admin/ui/views/TasksView/TaskDetail.tsx | Adds “copy shareable link” UI and URL construction logic for task detail. |
| src/admin/ui/views/TasksView/index.tsx | Refactors task selection to be URL-driven (selectedId/onSelect props). |
| src/admin/ui/types.ts | Adds publicBaseUrl to the admin bootstrap typing. |
| src/admin/ui/App.tsx | Implements hash-route parsing/serialization and back/forward sync. |
| src/admin/dashboard.ts | Includes publicBaseUrl in the escaped bootstrap JSON. |
| src/admin/adminServer.ts | Passes publicBaseUrl into the dashboard renderer. |
| agent-worker/index.js | Injects deterministic Virtual-Engineer: (and Change-Id) trailers into agent commits. |
| .github/copilot-instructions.md | Documents PUBLIC_BASE_URL in the env table. |
- App.tsx: guard parseHash decodeURIComponent against malformed hashes - TaskDetail: add type=button + aria-label to copy-link button - agent-worker: appendCommitTrailer rewrites trailer when value differs - orchestrator: reject blank publicBaseUrl when injecting taskPageUrl - tests: cover appendCommitTrailer converge/no-op behavior
|
Addressed the Copilot review in
Added Gates green: Note: the trailer change runs inside the agent container — rebuild the agent image to pick it up at runtime: |
Addresses second Copilot review on PR #77: - TasksView: a non-null deep-link id that is not in the loaded task list now shows a 'not found' state instead of silently rendering the first task (preserves the #/tasks/<id> deep-link contract). - index.ts: stop falling back to http://<host>:<port> for commit trailers and review summaries; only embed task-page links when PUBLIC_BASE_URL is explicitly configured. Avoids leaking non-shareable localhost links into artifacts that leave the machine. Removes now-unused resolvePublicBaseUrl. - agent-worker: rename injectChangeIds -> injectCommitTrailers to reflect that it injects both Change-Id and Virtual-Engineer trailers. - docs: config comment + copilot-instructions env note updated.
|
Thanks for the second pass @copilot — addressed in c45aad1:
Gates green: typecheck, typecheck:ui, lint, build:ui, and |
- agent-worker: detect the Virtual-Engineer trailer by parsing the trailer key/value instead of substring-matching the body, so a URL that only appears in free text no longer yields a false 'already present' (skipping injection) and a stale trailer value is reliably converged. Adds regression tests for the pre-check. - TaskDetail: drive the 'link copied' reset from a useEffect with cleanup so the timer is cancelled on unmount / re-copy, avoiding a setState-on-unmounted-component warning.
|
Thanks for the third pass @copilot — addressed in e25a157 (+ PR description update):
Gates green: typecheck, typecheck:ui, lint, build:ui, and |
- TaskDetail: clear stale actionError when copying the task link so a prior failure message no longer lingers after a successful copy. - agent-worker: escape regex metacharacters in appendCommitTrailer's trailer key before building the RegExp (defensive); add regression test. - docs: sync admin.md (task hash-routing + copy-link) and testing.md (taskPageUrl spec) per the doc auto-sync rules.
|
Thanks for the fourth pass @copilot — addressed in 6d9f7e1:
Gates green: typecheck, typecheck:ui, lint, build:ui, and |
Summary
Each task now has its own dedicated, shareable page in the admin UI, and every artifact Virtual Engineer produces links back to it — so a human reading a commit or a review can navigate straight to the VE page showing what was done for that task.
What's included
#/tasks/<id>) with browser back/forward support. The selected task is driven by the URL, andTaskDetailgains a copy-link button that yields a shareable URL.Virtual-Engineer: <url>footer (alongsideChange-Id), injected in the agent-worker so it applies across Gerrit, GitLab, and GitHub.— Reviewed by Virtual Engineer: <url>line back to the task page.PUBLIC_BASE_URLconfig — new optional env var for the public base URL used to build shareable links. When unset, task-page links are simply omitted from commit trailers and review summaries (we never emit a non-shareable localhost URL into artifacts that leave the machine). The value is shared by the orchestrator, review orchestrator, and dashboard bootstrap; the dashboard's copy-link button additionally falls back to the current browser location client-side.Notes
docker build -f Dockerfile.agent -t virtual-engineer-workspace:latest .Validation
All gates green on branch HEAD:
npm run typecheck/npm run typecheck:ui— zero errorsnpm run lint— cleannpm run build:ui— buildsnpm test— 1621 passed