Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b979c1b
feat(session): add the context compaction library
baptmont Jul 31, 2026
8e8b1dd
fix(compaction): address review of the compaction library
baptmont Aug 10, 2026
3f22d22
docs(compaction): specify the Summarizer contract and NewSummaryEvent…
baptmont Aug 11, 2026
e3211fb
feat(runner): compact session history after every N invocations
baptmont Jul 31, 2026
14323e2
fix(compaction): address review of the runner wiring
baptmont Aug 10, 2026
d679388
fix(compaction): harden the compaction library against malformed input
baptmont Aug 10, 2026
cfbfc23
fix(compaction): bound the summarizer transcript and hide bookkeeping…
baptmont Aug 10, 2026
e7a529c
fix(compaction): close the remaining library gaps from the #1231 review
baptmont Aug 11, 2026
1760131
feat(compaction): show summaries to plugins, and let the summarizer t…
baptmont Aug 11, 2026
8d88b32
docs(compaction): document the prose filter on NewSummaryEvent
baptmont Aug 11, 2026
fe49077
feat(telemetry): trace context compaction
baptmont Jul 31, 2026
8054683
fix(telemetry): stop a failed compaction reporting as a success
baptmont Aug 10, 2026
b582ac1
fix(telemetry): match the reference implementation's compaction attri…
baptmont Aug 10, 2026
2ea5b04
feat(telemetry): label the compaction span with gen_ai.system
baptmont Aug 10, 2026
6761dbd
feat(telemetry): connect the compaction span to its turn and its cost
baptmont Aug 11, 2026
ff5b84b
test(telemetry): pin the attribute key set, and say what the contract…
baptmont Aug 11, 2026
369700b
feat(compaction): compact mid-invocation once the prompt crosses a to…
baptmont Jul 31, 2026
0ce2ea9
fix(compaction): give tail retention the protections the sliding wind…
baptmont Aug 10, 2026
aa63cb5
fix(compaction): stop tail retention firing twice, latching on, or ki…
baptmont Aug 10, 2026
1d64846
fix(compaction): close the remaining tail-retention gaps
baptmont Aug 11, 2026
4157dc0
fix(compaction): stop compaction repeating when it cannot help
baptmont Aug 11, 2026
49acd83
feat(server): make context compaction reachable from every serving su…
baptmont Jul 31, 2026
ded7721
fix(server): fail fast on an unusable compaction config
baptmont Aug 10, 2026
94074c2
fix(server): keep the released controller constructor signatures
baptmont Aug 10, 2026
cb2d2a3
fix(launcher): refuse to start on a compaction config that cannot work
baptmont Aug 11, 2026
ecb95e7
fix(server): say when compaction cannot work on the surface it is set on
baptmont Aug 11, 2026
3a2436f
test(llmagent): add an end-to-end compaction test against a real model
baptmont Jul 31, 2026
de98738
test(llmagent): assert what the compaction e2e test actually establishes
baptmont Aug 10, 2026
b86939e
test(llmagent): exercise call pairing across a summary in the e2e rec…
baptmont Aug 10, 2026
f600945
test(llmagent): assert the compacted range, and drop the stale skip docs
baptmont Aug 11, 2026
06f453c
test(llmagent): make the compaction e2e assertions load-bearing
baptmont Aug 12, 2026
31b9cbc
fix(compaction): measure the transcript budget in characters, not bytes
baptmont Aug 12, 2026
02a14fc
fix(compaction): stop the progress gate disarming a long turn
baptmont Aug 12, 2026
f4dce0b
fix(compaction): stop a compaction failure failing the turn that prod…
baptmont Aug 12, 2026
9ea49dd
fix(compaction): copy a stored compaction, and omit absent range bounds
baptmont Aug 12, 2026
c15a082
fix(triggers): make the sliding-window warning say something true
baptmont Aug 12, 2026
51d6f38
fix(session): assign an event ID at append when one is missing
baptmont Aug 12, 2026
f350e6d
refactor(compaction)!: a Summarizer returns a summary, not an event
baptmont Aug 12, 2026
45ffbab
fix(compaction): name the events a summary replaces
baptmont Aug 12, 2026
878bac5
fix(compaction): keep the question the live turn is answering
baptmont Aug 12, 2026
01d2eba
fix(compaction): stop three ways a summarization could go wrong unnot…
baptmont Aug 12, 2026
6767c30
fix(compaction): keep the sliding window moving across a branch change
baptmont Aug 12, 2026
40e4634
fix(telemetry): report what actually became of a compaction
baptmont Aug 12, 2026
75693af
fix(adkrest): refuse a compaction config the server cannot actually s…
baptmont Aug 12, 2026
8c542ab
fix(compaction): make tail retention survive the sessions it exists for
baptmont Aug 12, 2026
6a4478d
refactor(compaction): publish only what a caller needs
baptmont Aug 12, 2026
320408e
fix(compaction): record the holes, and keep selection asking what is …
baptmont Aug 13, 2026
462e1fe
fix(compaction): close the three ways a summary was still trusted too…
baptmont Aug 13, 2026
9e75da6
fix(compaction): stop three app settings breaking the summarization
baptmont Aug 13, 2026
bf1a374
fix(compaction): key excluded events on what survives storage
baptmont Aug 13, 2026
b0f9efe
fix(compaction): let a rolling summary replace the one it was built from
baptmont Aug 13, 2026
dba6a2c
fix(compaction): finish the smaller items from the review
baptmont Aug 13, 2026
16b5e01
fix(compaction): stop a summarizer writing through the events it is h…
baptmont Aug 13, 2026
f6b0b83
fix(compaction): decide window membership by identity, not by the hol…
baptmont Aug 13, 2026
5c97781
fix(compaction): resume after a response, not only after a call
baptmont Aug 13, 2026
47045ca
fix(compaction): re-check the race guard after plugins have run
baptmont Aug 13, 2026
0963f59
fix(compaction): a plugin may rewrite a summary, not mint a record
baptmont Aug 13, 2026
b6a8e3c
fix(compaction): stop Agent Engine failing a turn it already answered
baptmont Aug 13, 2026
0f58bfb
fix(compaction): compare a hole at a precision every backend keeps
baptmont Aug 13, 2026
ae79bd4
test(compaction): make the conformance fixture able to see a precisio…
baptmont Aug 13, 2026
9db31a4
docs(compaction): say that a Summarizer must honour its context
baptmont Aug 13, 2026
888ee5c
docs(compaction): say that the two strategies do not compose
baptmont Aug 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,19 @@ func getAuthorForEvent(ctx Context, event *session.Event) string {
return ctx.Agent().Name()
}

// eventActionsFrom returns the actions a callback accumulated, less the fields
// that are the framework's to write rather than a callback's.
//
// A callback is handed the live [session.EventActions] so it can request state
// deltas, escalation and transfers, and the struct is then copied wholesale onto
// the persisted event. Anything on it that changes how later prompts are built
// has to be filtered out here, or the callback gets to set it.
func eventActionsFrom(actions *session.EventActions) session.EventActions {
out := *actions
out.Compaction = nil
return out
}

// runBeforeAgentCallbacks checks if any beforeAgentCallback returns non-nil content
// then it skips agent run and returns callback result.
func runBeforeAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
Expand All @@ -259,7 +272,7 @@ func runBeforeAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
}
event.Author = agent.Name()
event.Branch = ctx.Branch()
event.Actions = *actions
event.Actions = eventActionsFrom(actions)
ctx.EndInvocation()
return event, nil
}
Expand All @@ -280,7 +293,7 @@ func runBeforeAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
}
event.Author = agent.Name()
event.Branch = ctx.Branch()
event.Actions = *actions
event.Actions = eventActionsFrom(actions)
ctx.EndInvocation()
return event, nil
}
Expand All @@ -290,7 +303,7 @@ func runBeforeAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
event := session.NewEvent(ctx, ctx.InvocationID())
event.Author = agent.Name()
event.Branch = ctx.Branch()
event.Actions = *actions
event.Actions = eventActionsFrom(actions)
return event, nil
}

Expand Down Expand Up @@ -318,7 +331,7 @@ func runAfterAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
}
event.Author = agent.Name()
event.Branch = ctx.Branch()
event.Actions = *actions
event.Actions = eventActionsFrom(actions)
return event, nil
}
}
Expand All @@ -338,7 +351,7 @@ func runAfterAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
}
event.Author = agent.Name()
event.Branch = ctx.Branch()
event.Actions = *actions
event.Actions = eventActionsFrom(actions)
// TODO set context invocation ended
// ctx.invocationEnded = true
return event, nil
Expand All @@ -349,7 +362,7 @@ func runAfterAgentCallbacks(ctx InvocationContext) (*session.Event, error) {
event := session.NewEvent(ctx, ctx.InvocationID())
event.Author = agent.Name()
event.Branch = ctx.Branch()
event.Actions = *actions
event.Actions = eventActionsFrom(actions)
return event, nil
}
return nil, nil
Expand Down
7 changes: 7 additions & 0 deletions agent/llmagent/llm_agent_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,3 +757,10 @@ func (w *wrappedEvents) At(i int) *session.Event {
return nil
}
}

// Unwrap returns the session this one decorates.
//
// The seed a wrappedSession adds is a prompt-assembly convenience, not durable
// conversation. Anything that has to write to the session, or reason about what
// is actually stored, needs the session underneath.
func (w *wrappedSession) Unwrap() session.Session { return w.Session }
Loading