feat(backend): persist subagent tool-call context to task_session_subagents (#2671)

Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com>
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
This commit is contained in:
nova28
2026-08-15 22:58:14 +08:00
committed by GitHub
parent 6b27e67b04
commit 1ae8f4cf9f
37 changed files with 7751 additions and 40 deletions
@@ -481,3 +481,15 @@ type PlanRepository interface {
// otherwise a new revision is appended with revision_number computed inside the tx.
WritePlanRevision(ctx context.Context, head *models.TaskPlan, rev *models.TaskPlanRevision, coalesceLatestID *string) error
}
// SubagentContextRepository persists the durable, queryable record of a
// subagent (Task tool) invocation. See
// docs/specs/subagent-context-persistence/spec.md.
type SubagentContextRepository interface {
// UpsertSubagentContext inserts or merges one subagent invocation row,
// keyed on (task_session_id, tool_call_id). A single atomic statement —
// no read-then-write.
UpsertSubagentContext(ctx context.Context, sc *models.SubagentContext) error
ListSubagentContextsBySession(ctx context.Context, sessionID string) ([]*models.SubagentContext, error)
ListSubagentContextsByTurn(ctx context.Context, turnID string) ([]*models.SubagentContext, error)
}