SDK: add includeCurrentDatetime flag to suppress datetime injection#1406
Open
Halcyonhal9 wants to merge 1 commit into
Open
SDK: add includeCurrentDatetime flag to suppress datetime injection#1406Halcyonhal9 wants to merge 1 commit into
Halcyonhal9 wants to merge 1 commit into
Conversation
d4e3d52 to
9028173
Compare
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>
9028173 to
605da96
Compare
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.
Why
Surfaces a new opt-in
includeCurrentDatetimesession option across everySDK language so callers can suppress the runtime's injected
<current_datetime>tag on model-facing user messages. This is the SDK-sidecounterpart 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:
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/timerather than the user's actual prompt.
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 areunaffected because the default remains
true.What changes
A single opt-in option on
SessionConfig/ResumeSessionConfig(or thelanguage-equivalent) that serialises to the JSON wire field
includeCurrentDatetime. The runtime contract is defined ingithub/copilot-agent-runtime#8130.
SessionConfigBase.includeCurrentDatetime?: booleancreate_session(..., include_current_datetime=...)+resume_session(..., include_current_datetime=...)SessionConfig.IncludeCurrentDatetime/ResumeSessionConfig.IncludeCurrentDatetime(*bool)SessionConfigBase.IncludeCurrentDatetime(bool?)SessionConfig.include_current_datetime/ResumeSessionConfig.include_current_datetime+with_include_current_datetimebuilderSessionConfig.includeCurrentDatetime/ResumeSessionConfig.includeCurrentDatetime+SessionRequestBuilder.includeCurrentDatetime+ clone/Jackson/builder unit testsBehaviour:
null/None/nil): noincludeCurrentDatetimefield is sent over the wire. The runtime preserves today's behaviour and
injects
<current_datetime>— backwards compatible for every existingcaller.
true: explicit opt-in, equivalent to default.false: SDK sendsincludeCurrentDatetime: false. A runtime thatsupports 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
includeCurrentDatetimefield and continue to inject
<current_datetime>as before; no parseerrors 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/copilotcontaining PR #8130) to actuallyobserve 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):
npm testnpm run lintanywarnings)pytest --ignore=e2eruff check .pytest e2ego test ./...golangci-lint rundotnet testcargo test --features test-supportgpt-5.2false, 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.pyexcluded due to a pre-existingindefinite hang on macOS (asyncio/timeout interaction), unrelated to this
change.
³
go/definetool.go:210— pre-existing onmain, not in the patchedfiles.
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
github/copilot-agent-runtime#8130