feat(orchestration): a prompt records which run it became - #441
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 loopdocs/self-improvement-plan.mdnames as blocked on exactly this join.trackedRunIdTypecheck clean · 125/125 unit files green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn