Skip to content

Fix trajectory viewer showing wrong trajectory name in header#160

Merged
khaliqgant merged 5 commits intomainfrom
fix/trajectory-selection-bug
Jan 12, 2026
Merged

Fix trajectory viewer showing wrong trajectory name in header#160
khaliqgant merged 5 commits intomainfrom
fix/trajectory-selection-bug

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • Fixed trajectory viewer to show the correct trajectory name in the header when selecting from history
  • Previously, clicking on a trajectory showed the active trajectory's name in the header, making it appear as if the wrong trajectory was opened
  • Now the selected trajectory's title is looked up from history and displayed

Root Cause

The agentName prop was always set to trajectoryStatus?.task, which is the currently active trajectory's task, not the selected trajectory's title.

Fix

Added a useMemo to look up the selected trajectory's title from the trajectoryHistory array, and use that in the header when a trajectory is selected.

Test plan

  • Open trajectory panel
  • Click on any trajectory in the list
  • Verify the header shows the correct trajectory name (matching what you clicked)
  • Click "List" to go back
  • Verify header shows "Trajectories" or active task name

🤖 Generated with Claude Code

When clicking on a trajectory in the history list, the header was
showing the currently active trajectory's name instead of the selected
trajectory's name. This made it appear as if the wrong trajectory was
opened.

Fix: Look up the selected trajectory's title from the history array
and use it in the header. Falls back to active trajectory task name
or "Trajectories" for the list view.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@my-senior-dev-pr-review
Copy link
Copy Markdown

my-senior-dev-pr-review Bot commented Jan 12, 2026

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/dashboard/react-components/ (4 edits) • ⚡ 19th PR this month

View your contributor analytics →


📊 11 files reviewed • 1 high risk • 1 need attention

🚨 High Risk:

  • src/daemon/agent-signing.ts — Modifications affect key generation and management; critical security implications.

⚠️ Needs Attention:

  • src/daemon/agent-signing.ts — Variable name change could impact maintainability and consistency in key handling.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

Agent Relay and others added 4 commits January 12, 2026 09:13
1. Initial fetch effect now only runs once on mount instead of on every
   refresh change. This prevents racing with the selection change effect.

2. Set loading state immediately when selecting a trajectory to avoid
   flash of empty state before the fetch effect runs.

These fixes address:
- Double-click requirement to open a trajectory
- Potential race conditions between multiple effects

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The react-hooks/exhaustive-deps rule is not configured in this project's
eslint setup. Changed to include refresh in deps array with
hasInitializedRef guard to ensure single execution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- context-compaction.ts: prefix unused punctuationChars with _
- context-compaction.test.ts: remove unused CompactionConfig import
- server.ts: remove unused SendPayload import
- enhanced-features.ts: remove unused CompiledPatterns import
- consensus.ts: prefix unused totalWeight with _
- consensus.test.ts: remove unused ConsensusConfig import, prefix unused p1 with _
- agent-signing.ts: remove unused KeyObject import, prefix unused keyId with _
- agent-signing.test.ts: remove unused AgentKeyPair import

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The previous fix renamed totalWeight to _totalWeight in destructuring,
but the type definition still used totalWeight. Simply omit it from
destructuring since it's not used in the function body.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit 9ce3b50 into main Jan 12, 2026
6 checks passed
@khaliqgant khaliqgant deleted the fix/trajectory-selection-bug branch January 12, 2026 10:56
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