feat(agent): add disable_history_injection config option#3201
Open
wyjBot wants to merge 15 commits intoHKUDS:nightlyfrom
Open
feat(agent): add disable_history_injection config option#3201wyjBot wants to merge 15 commits intoHKUDS:nightlyfrom
wyjBot wants to merge 15 commits intoHKUDS:nightlyfrom
Conversation
Feishu streaming cards auto-close after 10 minutes from creation, regardless of update activity. With resuming enabled, a single card lives across multiple tool-call rounds and can exceed this limit, causing the final response to be silently lost. Remove the _resuming logic from send_delta so each tool-call round gets its own short-lived streaming card (well under 10 min). Add a fallback that sends a regular interactive card when the final streaming update fails.
When deliver: false is set in cron job payload, suppress all output even when agent calls message tool during the turn. Closes HKUDS#3115
Add a built-in tool that lets the agent inspect and modify its own runtime state (model, iterations, context window, etc.). Key features: - inspect: view current config, usage stats, and subagent status - modify: adjust parameters at runtime (protected by type/range validation) - Subagent observability: inspect running subagent tasks (phase, iteration, tool events, errors) — subagents are no longer a black box - Watchdog corrects out-of-bounds values on each iteration - Enabled by default in read-only mode (self_modify: false) - All changes are in-memory only; restart restores defaults - Comprehensive test suite (90 tests) Includes a self-awareness skill (always-on) with progressive disclosure: SKILL.md for core rules, references/examples.md for detailed scenarios.
PyJWT and cryptography are optional msteams deps; they should not be bundled into the generic dev install. Tests now skip the entire file when the deps are missing, following the dingtalk pattern.
Warn when validate_inbound_auth is disabled (default) so operators are aware the webhook accepts unverified requests. Restore pymupdf to the dev optional-dependencies group — its removal in the original PR was unrelated to the Teams channel feature.
- Check both jwt and cryptography in MSTEAMS_AVAILABLE guard so partial installs fail early with a clear message instead of at runtime - Add aclose() to test FakeHttpClient so stop() won't crash - Move MSTEAMS.md into README.md following the same details/summary pattern used by every other channel - Note in README that validateInboundAuth defaults to false
Introduce `AgentDefaults.disable_history_injection` (default `false`).
When set to `true`, the `# Recent History` block derived from
`history.jsonl` is omitted from the system prompt, giving users full
control over whether unprocessed history entries are auto-injected into
each conversation turn.
Changes:
- `config/schema.py`: new `disable_history_injection: bool = False` field on `AgentDefaults`
- `agent/context.py`: `ContextBuilder` accepts and stores the flag; `build_system_prompt` skips the history block when it is set
- `agent/loop.py`: `AgentLoop.__init__` accepts and forwards `disable_history_injection` to `ContextBuilder`
- `nanobot.py`: `NanoBot.from_config` passes `defaults.disable_history_injection` to `AgentLoop`
Usage in `config.json`:
```json
{
"agents": {
"defaults": {
"disable_history_injection": true
}
}
}
```
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
Summary
disable_history_injection: bool = FalsetoAgentDefaultsinconfig/schema.pyContextBuilderstores the flag and skips the# Recent Historyblock inbuild_system_promptwhen it istrueAgentLoopforwards the flag from its constructor toContextBuilderNanoBot.from_configpassesdefaults.disable_history_injectiontoAgentLoopMotivation
On every turn,
build_system_promptautomatically appends a# Recent Historysection sourced fromhistory.jsonl(up to 50 entries). For agents with long-running histories or privacy-sensitive workspaces, this can:There was previously no way to opt out without patching source code. This PR exposes a first-class config knob.
Usage
Default is
false, so existing behaviour is fully preserved.Test plan
AgentDefaults()hasdisable_history_injection=Falseby defaultContextBuilder(workspace, disable_history_injection=True).build_system_prompt()produces a prompt without# Recent HistoryContextBuilder(workspace, disable_history_injection=False).build_system_prompt()still includes history entries when present225 passed, 4 skipped)🤖 Generated with Claude Code