Skip to content

Filter hackbot UI runs by selected agent and drop localStorage#6365

Draft
suhaibmujahid wants to merge 1 commit into
mozilla:masterfrom
suhaibmujahid:worktree-hackbot-ui-agent-runs-filter
Draft

Filter hackbot UI runs by selected agent and drop localStorage#6365
suhaibmujahid wants to merge 1 commit into
mozilla:masterfrom
suhaibmujahid:worktree-hackbot-ui-agent-runs-filter

Conversation

@suhaibmujahid

Copy link
Copy Markdown
Member

What

The hackbot UI recent-runs panel now shows only runs from the agent selected in the trigger form, and no longer relies on the browser's localStorage for the list of runs.

Why

Previously the panel merged the hackbot-api GET /runs response with a localStorage store (lib/store.ts), and it showed runs from all agents regardless of which agent was selected. Selecting an agent had no effect on the panel.

Changes

  • hackbot-api: GET /runs accepts an optional agent query param and filters server-side (the agent column is already indexed).
  • UI lib/hackbot.ts: listRuns(limit, agent?) forwards the filter.
  • UI /api/runs: passes the agent query param through.
  • UI lib/agents.ts (new): shared agent list + parseAgent, used by both the trigger form and the panel so they agree on the selected agent.
  • UI TriggerForm: selecting an agent writes ?agent= to the URL.
  • UI RecentRuns: reads the selected agent from ?agent=, fetches only that agent's runs from the API, and refetches on change / while polling. Wrapped in Suspense (uses useSearchParams).
  • UI: removed lib/store.ts and all localStorage usage (also dropped the now-unused updateRunStatus/saveRun calls in RunDetail/TriggerForm).
  • README: updated the stale note about there being no upstream list-runs endpoint.

Notes

  • With no ?agent= param, both the form and the panel default to bug-fix, so they stay consistent.
  • Could not run next build/tsc in this environment (no node_modules, registry not reachable); the pre-commit prettier hook over the TS/TSX files passed.

The recent-runs panel now sources its list entirely from the hackbot-api
GET /runs endpoint, filtered server-side to the agent selected in the
trigger form (carried in the ?agent= URL param). This removes the
localStorage run store, which was only needed because the panel could not
list runs from the backend.

- hackbot-api: add optional agent filter to GET /runs
- ui: listRuns(limit, agent); /api/runs passes agent through
- ui: shared lib/agents.ts (agent list + parseAgent) used by the form and panel
- ui: selecting an agent updates ?agent= so the panel refetches for it
- ui: delete lib/store.ts and all localStorage usage
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