-
Notifications
You must be signed in to change notification settings - Fork 289
fix: restore Agents details panel + replay date input usability + data-testid forwarding #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: restore Agents details panel + replay date input usability + data-testid forwarding #117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to Polymarket Agents. Thank you for creating your first PR. Cheers!
| /> | ||
| )} | ||
| {view === 'replay' && <ReplayView />} | ||
| {view === 'chat' && <ChatView />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChatView ignores selected agent from navigation
When handleOpenChat(agentId) is called from AgentsView, it sets selectedAgentId in App state and navigates to the chat view. However, ChatView is rendered without any props (<ChatView />), so it doesn't receive the selected agent. ChatView maintains its own internal selectedAgentId state initialized to empty string, and its useEffect auto-selects the first agent from the list. This means clicking "Chat" for a specific agent shows the wrong agent selected in the chat interface.
Body:
Fix Agents Details: ensure selection updates and details panel renders reliably
Fix Replay date inputs: switch to text inputs with multi-format parsing + validation + persistence
Add data-testid hooks needed for Comet QA selectors
Fix UI components (Button/Card) to forward DOM attributes (e.g., data-testid) via props spread
QA checklist
Agents: clicking Details updates right panel and header
Replay: typing/pasting dates works; values persist after Load; invalid formats show error
Comet selectors: [data-testid="agent-detail-panel"], replay-from/to/load, etc. present
Type-check + build passpread
data-testid hooks verified in DevTools: agent-detail-panel, agent-detail-title, replay-from/to/load
Note
Establishes a TypeScript monorepo alongside Python with a full Node API and React web dashboard.
/health,/agents,/replay,/chat), Zod validation, centralized error handling, in-memory stores (state/equity/log/chat), agent strategies (FlatValue, FractionalKelly, RandomBaseline) viaAgentRegistry, trading engine (applyOrderIntents) with PnL/exposure logic, agent runner + scheduler, market data layer (Gamma/CLOB) mapped toMarketSnapshot, and comprehensive tests (Vitest)Written by Cursor Bugbot for commit 9e6ba5d. This will update automatically on new commits. Configure here.
Summary
This PR addresses QA automation blockers and review feedback across Atlas Prediction Lab:
Ensures data-testid attributes propagate correctly through shared UI components (Button/Card).
Removes duplicate “initial fetch” calls on mount where usePolling(..., enabled=true) already performs the initial request.
Prevents duplicated user messages in the LLM prompt by building the message array before persisting the current user message into the chat store.
Removes leftover debug logging from App.tsx.
Changes
apps/web/src/ui/Button.tsx, apps/web/src/ui/Card.tsx
Forward DOM attributes reliably (e.g., data-testid, aria-*) by spreading props correctly.
apps/web/src/components/AgentsView.tsx
Remove redundant mount useEffect fetch (usePolling already does initial fetch).
apps/web/src/components/Dashboard.tsx, apps/web/src/components/AgentDetail.tsx
Remove redundant mount fetch for same reason.
apps/web/src/App.tsx
Remove debug console.log.
apps/api/src/services/ChatService.ts
Fix duplicated user message in LLM prompt (avoid adding the user message to history before building the prompt messages).
How to test (manual)
Start dev:
pnpm -C apps/api dev
pnpm -C apps/web dev
Agents page:
Verify details panel updates when switching agents.
Verify data-testid selectors exist in DOM (DevTools console):
document.querySelector('[data-testid="agent-detail-panel"]')
document.querySelectorAll('[data-testid^="agent-details-btn-"]').length
Replay page:
Verify date inputs accept typing/paste and persist after “Load Replay”.
Verify selectors:
document.querySelector('[data-testid="replay-from"]')
document.querySelector('[data-testid="replay-to"]')
Chat:
Send a message and confirm it does not appear twice in the prompt/context behavior.
Notes
usePolling already handles initial fetch; removing the extra mount fetch reduces duplicate network calls.
Fix ChatView history pairing bug (sentMessageRef + effect only on chatResponse)