Add context flags to TaskConfig#23992
Open
luisorofino wants to merge 2 commits into
Open
Conversation
Contributor
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 7c0acc6 | Docs | Datadog PR Page | Give us feedback! |
lucia-sb
approved these changes
Jun 10, 2026
752acca to
dac15e3
Compare
de3d175 to
8fba7d5
Compare
This was referenced Jun 11, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8fba7d5 to
d7902e3
Compare
dac15e3 to
3efa0b1
Compare
3 tasks
3efa0b1 to
52a1b30
Compare
d7902e3 to
0484d7a
Compare
Contributor
Validation ReportAll 21 validations passed. Show details
|
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.

What does this PR do?
Adds two optional boolean flags to
TaskConfig—clear_context_beforeandcompact_context_before— that give flow authors explicit control over context management before a task runs. Whenclear_context_beforeis set, the agent's history is fully reset before the task. Whencompact_context_beforeis set, the context is compacted unconditionally, regardless of usage thresholds. Both flags take priority over the automatic compaction logic and are mutually exclusive (validated at config parse time).Motivation
The existing automatic compaction only triggers when context usage crosses a threshold, which is not always the right behavior. Some tasks benefit from starting with a completely clean slate (e.g., independent subtasks that should not see prior work), while others benefit from a forced compaction regardless of how full the context is. These flags give flow authors the control they need without relying on heuristic-based auto-compaction.
Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged