Include conversation ancestry in execution observations

This commit is contained in:
2026-11-14 01:20:06 +00:00
parent 04569e44df
commit e5c42de06d
6 changed files with 79 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import (
// calls methods in execution order; it has no shared history or background work.
type Recorder struct {
runID string
parentRunID string
startedAt time.Time
now func() time.Time
observer domain.ExecutionObserver
@@ -95,6 +96,9 @@ func NewRunID() (string, error) {
// RunID returns this invocation's identity.
func (r *Recorder) RunID() string { return r.runID }
// SetParentRunID records the immediate source identity before start delivery.
func (r *Recorder) SetParentRunID(id string) { r.parentRunID = id }
// Start delivers the opening event with only identities already resolved.
func (r *Recorder) Start() {
event := r.event(domain.ExecutionStarted)
@@ -177,7 +181,7 @@ func (r *Recorder) Finish(data FinishData) {
func (r *Recorder) event(kind domain.ExecutionEventKind) domain.ExecutionEvent {
return domain.ExecutionEvent{
Kind: kind, RunID: r.runID, Time: r.now(), PromptID: r.selection.PromptID,
Kind: kind, RunID: r.runID, ParentRunID: r.parentRunID, Time: r.now(), PromptID: r.selection.PromptID,
ProfileID: r.selection.ProfileID,
BackendID: r.selection.BackendID, Model: r.selection.Model,
}