Skip to content

feat(orchestration): a prompt records which run it became - #441

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/prompt-history-runid
Aug 29, 2026
Merged

feat(orchestration): a prompt records which run it became#441
github-actions[bot] merged 1 commit into
mainfrom
fix/prompt-history-runid

Conversation

@catomean

Copy link
Copy Markdown
Collaborator

Phase 0 of the fleet AI-engine plan (see the session's Fleet AI Engine artifact): prompt_history.runId + the ordered, linked pair in the run route — the prompt is written AFTER the run exists and carries its id. Unparks the trajectory-learning loop docs/self-improvement-plan.md names as blocked on exactly this join.

  • Migration 0061: column + FK (SET NULL) + index
  • run route: insert moved below run creation, carries trackedRunId
  • inject-core / tab-inject: id was already in scope, now recorded
  • activity-capture: null on purpose (terminal prompts have no run)

Typecheck clean · 125/125 unit files green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Phase 0 of the fleet AI-engine plan — the smallest change that unparks the
trajectory-learning loop docs/self-improvement-plan.md wrote down on
2026-08-07 and then could not start.

The plan's own finding: FleetCrown improves from what it READS (the frontier
loop), not from what it DOES, because the one dataset nobody else has —
prompts joined to graded outcomes with cross-lineage verdicts and real
costs — was not joinable. prompt_history had no runId; the only join was
(userId, projectKey, adapter, intent, time-proximity), which is lossy under
concurrency, and concurrency is the normal operating state.

It was never a pure schema change. In the orchestration run route the prompt
was logged fire-and-forget BEFORE the run row existed, so the id could not be
recorded even once the column existed. That write now happens after the run
is created — the ordered, linked pair — and stays fire-and-forget, because a
ledger hiccup must not block a dispatch. inject-core and tab-inject already
had the run id in scope at their writes and only needed the field passed.
Activity-capture rows keep a null runId on purpose: a prompt typed straight
into a terminal has no run to join.

ON DELETE SET NULL: losing a run must not erase the prompt from the ledger.

Migration 0061 adds the column, FK and index. Typecheck clean; 125/125 unit
test files pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
@github-actions
github-actions Bot merged commit 4bd2067 into main Aug 29, 2026
3 checks passed
@github-actions
github-actions Bot deleted the fix/prompt-history-runid branch August 29, 2026 08:44
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