Skip to content

fix(interview): repair interview-history endpoint + show past interviews in Step 5#692

Open
alreadyhavefeel wants to merge 1 commit into
666ghj:mainfrom
alreadyhavefeel:fix/interview-history-view
Open

fix(interview): repair interview-history endpoint + show past interviews in Step 5#692
alreadyhavefeel wants to merge 1 commit into
666ghj:mainfrom
alreadyhavefeel:fix/interview-history-view

Conversation

@alreadyhavefeel

Copy link
Copy Markdown

Summary

The interview-history capability already exists — interviews are written to each platform's OASIS SQLite DB and POST /api/simulation/interview/history reads them back — but it was broken in two places, so past interviews never appeared in the UI.

Bug 1 — backend endpoint crashes on mixed-type timestamps

SimulationRunner.get_interview_history merges twitter + reddit results and sorts by timestamp. The two platform DBs store created_at with different types (one comes back int-like, the other a datetime string), so the sort raises:

TypeError: '<' not supported between instances of 'int' and 'str'

Any multi-platform history query (the default) 500s. Fix: coerce the sort key to str.

results.sort(key=lambda x: str(x.get("timestamp", "")), reverse=True)

Bug 2 — Step 5 never loads the history

Step5Interaction.vue only kept interviews in an in-memory cache for the current session, so they vanished on reload and the persisted history was never surfaced. This wires it up:

  • getInterviewHistory(simulationId, opts) in api/simulation.js → calls the existing POST /api/simulation/interview/history.
  • On mount, Step 5 loads the history and seeds the per-agent chat cache: sorted chronologically, the injected interview-prompt prefix stripped for display, and deduped across platforms (the same question is recorded once per platform). Selecting an agent now shows prior Q&A.

Testing

  • Endpoint previously 500'd on a run with both platforms; after the fix it returns the full history (verified: 43 records across the interviewed agents).
  • Step 5 loads and displays prior interviews on mount; live interviewing is unchanged.

Scope

Backend: 1-line fix in simulation_runner.py. Frontend: additive API helper + a mount-time loader in Step5Interaction.vue. No API contract or schema changes.

…terviews in UI

The interview-history feature already existed (interviews are recorded to each
platform's OASIS sqlite DB and `POST /api/simulation/interview/history` reads
them) but was broken on two fronts:

1. Backend crash: get_interview_history sorts merged twitter+reddit results by
   "timestamp", but the two platforms store created_at with different types
   (one int-like, one datetime string), raising
   "'<' not supported between instances of 'int' and 'str'". Coerce the sort
   key to str so mixed-type timestamps sort safely.

2. Step 5 (Interaction) never loaded that history, so past interviews vanished
   on reload. Add getInterviewHistory() and load it on mount, seeding the
   per-agent chat cache (chronological, prompt-prefix stripped, deduped across
   platforms) so selecting an agent shows prior Q&A.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants