[DEV-108] Make dashboard status data trustworthy: show branch & harness on runs, fix false 'worker stopped', and list open agent PRs with links - #102
Merged
Conversation
…w branch & harness on runs, fix false 'worker stopped', and list open agent PRs with links
Ticket links on /api/agent-prs were re-derived at read time from the dashboard process's own TASK_TRACKER env, so switching the task tracker (or running the dashboard standalone without tracker env) broke or mislinked existing PRs. Instead, the worker now derives the ticket URL when the PR is created (in recordAgentPrFromUrl, where the project's tracker config is loaded) and persists it in a new agent_prs.ticket_url column (additive migration following the runs table pattern). The dashboard replays the stored URL verbatim; listOpenAgentPrs reads with SELECT * so a readonly dashboard still lists PRs from databases predating the column.
# Conflicts: # docs/code/dashboard.md # packages/code/src/lib/review-polling-acquirer.ts
Contributor
Author
|
🔀 This branch had merge conflicts with |
resolveWorkerStatus checked the project-dir lock first and returned it whenever a readable lock file existed, so a stale lock left behind by a crashed worker (dead pid) shadowed the live workspace-home lock taken by the currently running fleet worker — the dashboard kept reporting 'worker stopped' while a worker was actually running. Both lock locations are now always read; a live lock wins regardless of location, and 'stopped' is only reported when every readable lock belongs to a dead process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task: DEV-108
Summary: Make dashboard status data trustworthy: show branch & harness on runs, fix false 'worker stopped', and list open agent PRs with links
Implementation Details
Now let me look at the dashboard-ui package structure:
Let me look at the branch creation and harness resolution flow in index.ts:
I have a good picture now. Let me set up a task list and study the remaining files:
Let me check a few more details — the test setup, agent-harness resolveHarness, and worker docs:
Now let me see the rest of the review-polling tests to make sure the reconciler integration won't break them:
The picture is clear. Let me check a few last implementation details:
Now I'll implement. Starting with the new agent PR reconciler module:
Now update
review-polling-acquirer.tsto use the reconciler (shared fetch, gone handling):Now the
tick()andpollPr()methods:Let me fix a leftover artifact in that edit and properly log closures:
Now add the
isGitHubNotFoundhelper to github-reviews.ts:Now update the workspace-worker's fetchPr adapter to map 404s to
gone:Now
run-recorder.ts— add branch recording:Now wire it into
index.ts— harness atbeginRun, branch after creation:Now
address-review.ts— record the harness on pr_mention runs:Now
lock-manager.ts— support plain-dir locks and expose the lock file path:Now
dashboard-api.ts— worker liveness and the agent PRs endpoint:Now the worker-status handler rewrite:
Now the server route in
dashboard-server.ts:Now the dashboard-ui. First the API types:
Now the StatusStrip with three liveness states and a PR-count link:
Now the new PRs view:
Wire the route and tab in App.tsx:
Now add the Branch column to the runs list:
Now the reconciler tests:
Now update the dashboard-api tests:
Now add lock-manager tests for the plainDir option:
Add reconciliation tests to the review-polling test suite:
Add
setRunBranchtests to the run-recorder suite:Now the dashboard-ui tests:
Now let's verify — typecheck and run the affected tests:
The auth failure looks like a missing install in this worktree. Let me install dependencies first:
Typecheck passes. Now run the affected test suites:
The COALESCE order was inverted — fix
setRunBranchto true no-clobber semantics:Now the full code package test suite:
All code tests pass. Now the dashboard-ui tests:
All green. Now lint and format:
Lint warnings are pre-existing. Now format:
Format is stable. Now verify the full build works:
Build passes. Now update the docs:
Let me do a careful self-review of the final diff:
Let me check worker.md for a natural place to mention reconciliation:
Final verification — full test suites, typecheck, lint:
All checks pass. Final diff summary:
DEV-108 is implemented and fully verified (typecheck, lint, format, build, 1072 code tests + 64 UI tests pass).
What changed
1. Runs record harness & branch (
packages/code/src/index.ts,run-recorder.ts,address-review.ts)beginRunnow recordsharness: resolvedAgent.harness.namefor task/scheduled runs; pr_mention runs (address-review.ts:488) record it too. Conflict-resolution runs already did.RunStore.setRunBranch+recordRunBranch()attach the actual branch aftercreateFeatureBranchsucceeds (it can gain an-attempt-Nsuffix). COALESCE semantics never clobber a branch recorded at run start.–.2. Worker liveness is truthful (
dashboard-api.ts,lock-manager.ts,StatusStrip.tsx)GET /api/workernow returnsworker: { status: "running" | "stopped" | "unknown", pid?, startedAt?, lockFile? }..devintern-code/.worker.lockand the workspace home's.worker.lock(fleet/launchd mode — the false "stopped" case). Dead pid →stopped; no lock anywhere → explicit "worker status unknown" instead of claiming stopped.3. Agent PR count reconciled with GitHub (
agent-pr-reconciler.tsnew,review-polling-acquirer.ts,workspace-worker.ts)reconcileOpenAgentPrs()conditionally GETs every watched PR (reusing the sharedgithub:pr:ETag cursors — 304s are rate-limit-free, honoring the App-vs-PAT note) and closes registry rows whose PR is closed/merged or gone (404 → renamed/transferred/deleted, mapped via newisGitHubNotFound).4. Open PRs listed with links (
/api/agent-prs+ new PRs view)AgentPrsViewtable; the header's "N agent PRs open" now links to it.Tests & docs: new
agent-pr-reconciler.test.ts, plus coverage for plainDir lock reads, 3-state worker status, workspace fallback,/api/agent-prsend-to-end, gone-PR unwatching, shared-fetch accounting,formatAge, and UI components.docs/code/dashboard.mdandworker.mdupdated.This PR was automatically created by @devintern/code