Skip to content

SDK: add includeCurrentDatetime flag to suppress datetime injection#1406

Open
Halcyonhal9 wants to merge 1 commit into
github:mainfrom
Halcyonhal9:benapple/test-include-current-datetime
Open

SDK: add includeCurrentDatetime flag to suppress datetime injection#1406
Halcyonhal9 wants to merge 1 commit into
github:mainfrom
Halcyonhal9:benapple/test-include-current-datetime

Conversation

@Halcyonhal9
Copy link
Copy Markdown

@Halcyonhal9 Halcyonhal9 commented May 24, 2026

Why

Surfaces a new opt-in includeCurrentDatetime session option across every
SDK language so callers can suppress the runtime's injected
<current_datetime> tag on model-facing user messages. This is the SDK-side
counterpart to runtime PR
github/copilot-agent-runtime#8130,
which performs the actual suppression on the runtime side.

Two real-world failure modes motivated the flag:

  1. Short-prompt summarisation pollution. When a host application makes
    a short SDK call to summarise a user prompt (e.g. to name a chat
    session), the model frequently latches onto the injected
    <current_datetime> block and produces a summary about the date/time
    rather than the user's actual prompt.
  2. User-supplied date/time confusion. When the user's prompt itself
    contains a date or time and the task depends on that user-provided
    value, the model often conflates it with the SDK-injected
    <current_datetime> tag.

Hosts that need either case can now opt out by passing
includeCurrentDatetime: false; existing callers that rely on the tag are
unaffected because the default remains true.

What changes

A single opt-in option on SessionConfig / ResumeSessionConfig (or the
language-equivalent) that serialises to the JSON wire field
includeCurrentDatetime. The runtime contract is defined in
github/copilot-agent-runtime#8130.

Language Surface added
Node.js SessionConfigBase.includeCurrentDatetime?: boolean
Python create_session(..., include_current_datetime=...) + resume_session(..., include_current_datetime=...)
Go SessionConfig.IncludeCurrentDatetime / ResumeSessionConfig.IncludeCurrentDatetime (*bool)
.NET SessionConfigBase.IncludeCurrentDatetime (bool?)
Rust SessionConfig.include_current_datetime / ResumeSessionConfig.include_current_datetime + with_include_current_datetime builder
Java SessionConfig.includeCurrentDatetime / ResumeSessionConfig.includeCurrentDatetime + SessionRequestBuilder.includeCurrentDatetime + clone/Jackson/builder unit tests

Behaviour:

  • Default (unset / null / None / nil): no includeCurrentDatetime
    field is sent over the wire. The runtime preserves today's behaviour and
    injects <current_datetime> — backwards compatible for every existing
    caller.
  • true: explicit opt-in, equivalent to default.
  • false: SDK sends includeCurrentDatetime: false. A runtime that
    supports the flag (PR #8130 and later) suppresses injection. A
    down-level runtime ignores the unknown field and continues to inject —
    see graceful-degradation note below.

Graceful degradation against down-level runtimes

The flag is purely additive on the wire. Down-level CLIs that don't
implement PR #8130 silently ignore the unknown includeCurrentDatetime
field and continue to inject <current_datetime> as before; no parse
errors are raised. This was verified in the runtime PR by pointing the
patched SDK at a down-level CLI bundled on the host. Callers therefore
need an updated CLI (@github/copilot containing PR #8130) to actually
observe the suppression, but the API surface itself remains safe.

Verification

CONTRIBUTING.md test commands run against this branch (macOS, against
runtime PR #8130 with the flag honoured end-to-end):

Language Suite Result
Node npm test ✅ 416 passed / 7 skipped
Node npm run lint ✅ 0 errors (3 pre-existing any warnings)
Python pytest --ignore=e2e ✅ 145 passed
Python ruff check . ✅ Clean
Python pytest e2e ⚠ 283 passed / 7 failed¹ / 6 skipped (+1 file skipped²)
Go go test ./... ✅ All packages pass
Go golangci-lint run ⚠ 1 pre-existing govet³ (not in patched files)
.NET dotnet test ✅ 463 passed / 2 skipped
Rust cargo test --features test-support ✅ All unit + 18 doctests
Java Custom E2E driver against gpt-5.2 ✅ Wire field appears with false, absent when default

¹ All 7 e2e failures are the same pre-existing macOS auth issue
(Failed to get token for auth info) in tests that spawn child processes
/ new clients; none of the failing tests touch includeCurrentDatetime.
² e2e/test_pending_work_resume_e2e.py excluded due to a pre-existing
indefinite hang on macOS (asyncio/timeout interaction), unrelated to this
change.
³ go/definetool.go:210 — pre-existing on main, not in the patched
files.

End-to-end verification with the matching runtime PR also covers the
GitHub provider against every SDK language using OTEL trace inspection
to confirm the <current_datetime> tag's presence/absence on the wire,
plus the down-level CLI graceful-degradation path. See the runtime PR
body for the full provider × language matrix:
https://github.com/github/copilot-agent-runtime/pull/8130

Linked PR

  • Runtime contract & wire-field handler:
    github/copilot-agent-runtime#8130

Copilot AI review requested due to automatic review settings May 24, 2026 01:03
@Halcyonhal9 Halcyonhal9 requested a review from a team as a code owner May 24, 2026 01:03
@Halcyonhal9 Halcyonhal9 force-pushed the benapple/test-include-current-datetime branch 2 times, most recently from d4e3d52 to 9028173 Compare May 24, 2026 01:32
Adds an opt-in `includeCurrentDatetime?: boolean` session/resume option
across all language bindings (Node, Python, Go, .NET, Rust, Java). When
`false`, the SDK forwards `includeCurrentDatetime: false` to the runtime,
which suppresses the injected `<current_datetime>` tag on model-facing
user messages. Defaults to true for backwards compatibility.

This is the SDK-side counterpart to copilot-agent-runtime PR
github/copilot-agent-runtime#8130, which is what actually does the
suppression work in the runtime. The combination is needed when short
prompts (e.g. session-name summarisation) are confused by datetime
context, or when the user's own prompt contains a date/time that
collides with the injected tag.

Surface added per language:

- Node:   `SessionConfigBase.includeCurrentDatetime?: boolean`
- Python: `create_session(..., include_current_datetime=...)` and
          `resume_session(..., include_current_datetime=...)`
- Go:     `SessionConfig.IncludeCurrentDatetime` /
          `ResumeSessionConfig.IncludeCurrentDatetime` (*bool)
- .NET:   `SessionConfigBase.IncludeCurrentDatetime` (bool?)
- Rust:   `SessionConfig.include_current_datetime` /
          `ResumeSessionConfig.include_current_datetime` plus
          `with_include_current_datetime` builder + wire fields
- Java:   `SessionConfig.includeCurrentDatetime` /
          `ResumeSessionConfig.includeCurrentDatetime` plus
          `SessionRequestBuilder.includeCurrentDatetime`, wire fields,
          and clone/jackson/builder unit tests

The wire field name is `includeCurrentDatetime` everywhere, matching
the runtime PR's request schema.

Verified locally with CONTRIBUTING.md test commands:

- nodejs: `npm test` 416 / 7 skipped; `npm run lint` 0 errors
- python: unit 145, ruff clean, e2e 283 / 7 pre-existing auth fails / 6
  skipped (failures unrelated to this change)
- go: `go test ./...` all pass; `golangci-lint run` 1 pre-existing
  govet in `definetool.go:210`
- dotnet: `dotnet test` 463 / 2 skipped
- rust: `cargo test --features test-support` all + 18 doctests pass
- java: custom E2E driver against gpt-5.2 (Halcyonhal9/lumi2 fork)

Refs: github/copilot-agent-runtime#8130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Halcyonhal9 Halcyonhal9 force-pushed the benapple/test-include-current-datetime branch from 9028173 to 605da96 Compare May 24, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant