Skip to content

Add context flags to TaskConfig#23992

Open
luisorofino wants to merge 2 commits into
loa/no-artifact-rootfrom
loa/task-context
Open

Add context flags to TaskConfig#23992
luisorofino wants to merge 2 commits into
loa/no-artifact-rootfrom
loa/task-context

Conversation

@luisorofino

@luisorofino luisorofino commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds two optional boolean flags to TaskConfigclear_context_before and compact_context_before — that give flow authors explicit control over context management before a task runs. When clear_context_before is set, the agent's history is fully reset before the task. When compact_context_before is 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)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@luisorofino luisorofino added the qa/skip-qa Automatically skip this PR for the next QA label Jun 10, 2026
@dd-octo-sts dd-octo-sts Bot added the ddev label Jun 10, 2026
@datadog-official

datadog-official Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 88.08% (-0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7c0acc6 | Docs | Datadog PR Page | Give us feedback!

@luisorofino luisorofino marked this pull request as ready for review June 10, 2026 09:40
@luisorofino luisorofino requested a review from a team as a code owner June 10, 2026 09:40

luisorofino commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@dd-octo-sts

dd-octo-sts Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ddev qa/skip-qa Automatically skip this PR for the next QA team/agent-integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants