Skip to content

chore(sync): upstream intake rollup#127

Merged
MillionthOdin16 merged 757 commits intomainfrom
sync/upstream-rollup-20260303-172324
Mar 3, 2026
Merged

chore(sync): upstream intake rollup#127
MillionthOdin16 merged 757 commits intomainfrom
sync/upstream-rollup-20260303-172324

Conversation

@MillionthOdin16
Copy link
Copy Markdown
Owner

@MillionthOdin16 MillionthOdin16 commented Mar 3, 2026

Automated upstream intake from upstream/main with curated replay-safe patches (core + infra).

Summary by CodeRabbit

Release Notes

  • New Features

    • Added bootstrap truncation warnings when context files exceed size limits. New configuration option agents.defaults.bootstrapPromptTruncationWarning controls warning behavior (off/once/always; default: once).
  • Bug Fixes

    • Console timestamps now render in local timezone instead of UTC.
    • Added security header X-Content-Type-Options: nosniff to media responses.
  • Documentation

    • Updated guides with bootstrap truncation warning behavior and configuration details.

steipete and others added 30 commits March 3, 2026 01:14
- Pass gfm:true + breaks:true explicitly to marked.parse() so table
  support is guaranteed even if global setOptions() is bypassed or
  reset by a future refactor (defense-in-depth)
- Add display:block + overflow-x:auto to .chat-text table so wide
  multi-column tables scroll horizontally instead of being clipped
  by the parent overflow-x:hidden chat container
- Add regression tests for GFM table rendering in markdown.test.ts
Take the safe, tested subset from openclaw#32367:\n- per-channel startup connect grace in health monitor\n- tool-context channel-provider fallback for message actions\n\nCo-authored-by: Munem Hashmi <[email protected]>
…w#32360)

* Plugin SDK: add run and tool call fields to tool hooks

* Agents: propagate runId and toolCallId in before_tool_call

* Agents: thread runId through tool wrapper context

* Runner: pass runId into tool hook context

* Compaction: pass runId into tool hook context

* Agents: scope after_tool_call start data by run

* Tests: cover run and tool IDs in before_tool_call hooks

* Tests: add run-scoped after_tool_call collision coverage

* Hooks: scope adjusted tool params by run

* Tests: cover run-scoped adjusted param collisions

* Hooks: preserve active tool start metadata until end

* Changelog: add tool-hook correlation note
…gins

## Overview

This PR enables external channel plugins (loaded via Plugin SDK) to access
advanced runtime features like AI response dispatching, which were previously
only available to built-in channels.

## Changes

### src/gateway/server-channels.ts
- Import PluginRuntime type
- Add optional channelRuntime parameter to ChannelManagerOptions
- Pass channelRuntime to channel startAccount calls via conditional spread
- Ensures backward compatibility (field is optional)

### src/gateway/server.impl.ts
- Import createPluginRuntime from plugins/runtime
- Create and pass channelRuntime to channel manager

### src/channels/plugins/types.adapters.ts
- Import PluginRuntime type
- Add comprehensive documentation for channelRuntime field
- Document available features, use cases, and examples
- Improve type safety (use imported PluginRuntime type vs inline import)

## Benefits

External channel plugins can now:
- Generate AI-powered responses using dispatchReplyWithBufferedBlockDispatcher
- Access routing, text processing, and session management utilities
- Use command authorization and group policy resolution
- Maintain feature parity with built-in channels

## Backward Compatibility

- channelRuntime field is optional in ChannelGatewayContext
- Conditional spread ensures it's only passed when explicitly provided
- Existing channels without channelRuntime support continue to work unchanged
- No breaking changes to channel plugin API

## Testing

- Email channel plugin successfully uses channelRuntime for AI responses
- All existing built-in channels (slack, discord, telegram, etc.) work unchanged
- Gateway loads and runs without errors when channelRuntime is provided
* Feishu: cache failing probes

* Changelog: add Feishu probe failure backoff note

---------

Co-authored-by: bmendonca3 <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
…penclaw#28623)

* feat(hooks): add trigger and channelId to plugin hook agent context

Adds `trigger` and `channelId` fields to `PluginHookAgentContext` so
plugins can determine what initiated the agent run and which channel
it originated from, without session-key parsing or Redis bridging.

trigger values: "user", "heartbeat", "cron", "memory"
channelId values: "telegram", "discord", "whatsapp", etc.

Both fields are threaded through run.ts and attempt.ts hookCtx so all
hook phases receive them (before_model_resolve, before_prompt_build,
before_agent_start, llm_input, llm_output, agent_end).

channelId falls back from messageChannel to messageProvider when the
former is not set. followup-runner passes originatingChannel so queued
followup runs also carry channel context.

* docs(changelog): note hook context parity fix for openclaw#28623

---------

Co-authored-by: Vincent Koc <[email protected]>
thewilloftheshadow and others added 22 commits March 3, 2026 11:20
…aw#27613)

Merged via squash.

Prepared head SHA: 31ddd43
Co-authored-by: dorukardahan <[email protected]>
Co-authored-by: grp06 <[email protected]>
Reviewed-by: @grp06
…claw#32206)

Merged via squash.

Prepared head SHA: d7f0914
Co-authored-by: hydro13 <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
…penclaw#32490)

Merged via squash.

Prepared head SHA: 233aa03
Co-authored-by: scoootscooob <[email protected]>
Co-authored-by: joshavant <[email protected]>
Reviewed-by: @joshavant
openclaw#32831)

Merged via squash.

Prepared head SHA: 2aa58f6
Co-authored-by: Sid-Qin <[email protected]>
Co-authored-by: shakkernerd <[email protected]>
Reviewed-by: @shakkernerd
Merged via squash.

Prepared head SHA: 5d6d4dd
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
…w#25970)

Merged via squash.

Prepared head SHA: 3012326
Co-authored-by: openperf <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
…penclaw#30356)

Merged via squash.

Prepared head SHA: b14f9ad
Co-authored-by: 13otKmdr <[email protected]>
Co-authored-by: grp06 <[email protected]>
Reviewed-by: @grp06
Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 6da593a)
(cherry picked from commit 8f9e7f9)
Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 811fc2d)
(cherry picked from commit 632a4dc)
Co-authored-by: Copilot <[email protected]>
(cherry picked from commit d55fa6f)
Copilot AI review requested due to automatic review settings March 3, 2026 22:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 3, 2026

Too many files changed for review. (1780 files found, 100 file limit)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58d1cfc and 78dc8ea.

📒 Files selected for processing (40)
  • CHANGELOG.md
  • changelog/fragments/pr-30356.md
  • docs/concepts/context.md
  • docs/concepts/system-prompt.md
  • docs/gateway/configuration-reference.md
  • src/agents/bootstrap-budget.test.ts
  • src/agents/bootstrap-budget.ts
  • src/agents/cli-runner.ts
  • src/agents/cli-runner/helpers.ts
  • src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.test.ts
  • src/agents/pi-embedded-helpers.ts
  • src/agents/pi-embedded-helpers/bootstrap.ts
  • src/agents/pi-embedded-runner/run.ts
  • src/agents/pi-embedded-runner/run/attempt.ts
  • src/agents/pi-embedded-runner/run/params.ts
  • src/agents/pi-embedded-runner/run/types.ts
  • src/agents/pi-embedded-runner/system-prompt.ts
  • src/agents/system-prompt-report.ts
  • src/agents/system-prompt.test.ts
  • src/agents/system-prompt.ts
  • src/auto-reply/reply/agent-runner-execution.ts
  • src/auto-reply/reply/commands-context-report.test.ts
  • src/auto-reply/reply/commands-context-report.ts
  • src/commands/agent.ts
  • src/commands/agent/session-store.test.ts
  • src/commands/agent/session-store.ts
  • src/commands/doctor-bootstrap-size.test.ts
  • src/commands/doctor-bootstrap-size.ts
  • src/commands/doctor.fast-path-mocks.ts
  • src/commands/doctor.ts
  • src/config/schema.help.ts
  • src/config/schema.labels.ts
  • src/config/sessions/types.ts
  • src/config/types.agent-defaults.ts
  • src/config/zod-schema.agent-defaults.ts
  • src/cron/isolated-agent/run.ts
  • src/logging/subsystem.ts
  • src/media/server.test.ts
  • src/media/server.ts
  • src/plugins/commands.test.ts

📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive bootstrap budget and truncation warning system. It adds a new bootstrap-budget module for analyzing file injection statistics and truncation, configuration options for controlling warning visibility modes, system prompt integration to display warnings, and updates various agent runners to track and propagate warning signatures across runs.

Changes

Cohort / File(s) Summary
Documentation & Changelog
CHANGELOG.md, changelog/fragments/pr-30356.md, docs/concepts/context.md, docs/concepts/system-prompt.md, docs/gateway/configuration-reference.md
Added documentation for bootstrap truncation warnings, new agents.defaults.bootstrapPromptTruncationWarning configuration option, security header assertion for media responses, and behavior notes for in-prompt warning injection.
Bootstrap Budget Core
src/agents/bootstrap-budget.ts, src/agents/bootstrap-budget.test.ts
New module implementing bootstrap budget analysis, injection statistics, truncation detection, warning signature generation, and state management. Defines constants, types, and functions for analyzing per-file and total truncation causes and formatting warnings.
Configuration Schema & Types
src/config/schema.help.ts, src/config/schema.labels.ts, src/config/types.agent-defaults.ts, src/config/zod-schema.agent-defaults.ts, src/config/sessions/types.ts
Added bootstrapPromptTruncationWarning configuration field with "off"/"once"/"always" modes, help/label entries, and bootstrapTruncation field to session system prompt report to track warning metadata.
Bootstrap Helpers & Exports
src/agents/pi-embedded-helpers/bootstrap.ts, src/agents/pi-embedded-helpers.ts, src/agents/pi-embedded-helpers.buildbootstrapcontextfiles.test.ts
Introduced DEFAULT_BOOTSTRAP_PROMPT_TRUNCATION_WARNING_MODE constant and resolveBootstrapPromptTruncationWarningMode resolver function, exported from pi-embedded-helpers.
CLI Agent Runner
src/agents/cli-runner.ts, src/agents/cli-runner/helpers.ts
Integrated bootstrap budget analysis into CLI agent execution flow; propagates bootstrap truncation warnings and signature tracking through system prompt construction and payload metadata.
Embedded Agent Runner
src/agents/pi-embedded-runner/run.ts, src/agents/pi-embedded-runner/run/attempt.ts, src/agents/pi-embedded-runner/run/params.ts, src/agents/pi-embedded-runner/run/types.ts, src/agents/pi-embedded-runner/system-prompt.ts
Integrated bootstrap budget analysis into embedded agent execution; added signature tracking across attempts, system prompt integration, and new public function injectHistoryImagesIntoMessages for message mutation.
System Prompt Integration
src/agents/system-prompt.ts, src/agents/system-prompt.test.ts, src/agents/system-prompt-report.ts
Updated system prompt builder to render bootstrap truncation warnings alongside context files; replaced injected workspace file construction with buildBootstrapInjectionStats; extended system prompt report with bootstrapTruncation metadata.
Auto-Reply & Command Handlers
src/auto-reply/reply/agent-runner-execution.ts, src/auto-reply/reply/commands-context-report.ts, src/auto-reply/reply/commands-context-report.test.ts, src/commands/agent.ts, src/commands/agent/session-store.ts, src/commands/agent/session-store.test.ts
Propagated bootstrap warning signature state across agent runs and retries; updated context report to use bootstrap budget analysis; persisted system prompt reports in session store for downstream deduplication.
Bootstrap Doctor Command
src/commands/doctor-bootstrap-size.ts, src/commands/doctor-bootstrap-size.test.ts, src/commands/doctor.ts, src/commands/doctor.fast-path-mocks.ts
Added new doctor command to analyze and report bootstrap file size usage against configured limits; displays truncation details and near-limit warnings.
Cron Agent Runner
src/cron/isolated-agent/run.ts
Integrated bootstrap warning signature tracking into cron-isolated agent runs; propagates signatures across sub-agent executions and persists session state.
Logging & Media Security
src/logging/subsystem.ts, src/media/server.ts, src/media/server.test.ts
Updated console logging to use formatConsoleTimestamp for local timezone rendering; added X-Content-Type-Options: nosniff security header to media routes.
Plugin Changes
src/plugins/commands.test.ts
Removed acceptsArgs field from public PluginCommandSpec interface.

Sequence Diagram

sequenceDiagram
    participant Config
    participant AgentRunner as Agent Runner
    participant BootstrapBudget as Bootstrap Budget
    participant SystemPrompt as System Prompt
    participant Agent

    AgentRunner->>Config: Resolve bootstrap limits & warning mode
    Config-->>AgentRunner: bootstrapMaxChars, bootstrapTotalMaxChars, warningMode
    
    AgentRunner->>BootstrapBudget: analyzeBootstrapBudget(files, limits)
    BootstrapBudget->>BootstrapBudget: Calculate injection stats
    BootstrapBudget->>BootstrapBudget: Detect per-file & total truncation
    BootstrapBudget-->>AgentRunner: BootstrapBudgetAnalysis
    
    AgentRunner->>BootstrapBudget: buildBootstrapPromptWarning(analysis, mode, seen)
    BootstrapBudget->>BootstrapBudget: Generate warning signature
    BootstrapBudget->>BootstrapBudget: Format warning lines
    BootstrapBudget-->>AgentRunner: BootstrapPromptWarning
    
    AgentRunner->>SystemPrompt: buildAgentSystemPrompt(bootstrapTruncationWarningLines)
    SystemPrompt->>SystemPrompt: Render Project Context section
    SystemPrompt->>SystemPrompt: Include truncation warning block
    SystemPrompt-->>AgentRunner: System Prompt with warnings
    
    AgentRunner->>Agent: Run with system prompt
    Agent-->>AgentRunner: Result with signature tracking
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Bootstrap files grow with care,
Budgets tracked with warnings fair,
Truncation wisdom now on display,
Helping agents find their way! 📊✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sync/upstream-rollup-20260303-172324

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MillionthOdin16 MillionthOdin16 merged commit 3583754 into main Mar 3, 2026
6 of 9 checks passed
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates a series of upstream changes primarily focused on enhancing the agent's context management, improving logging consistency, and bolstering security. Key updates include the introduction of configurable warnings for truncated bootstrap files, ensuring all console timestamps are displayed in the local timezone, and adding a crucial security header to media responses. These changes aim to provide clearer feedback to users regarding context limitations, offer a more user-friendly logging experience, and improve the overall security posture of the application.

Highlights

  • New Feature: Bootstrap Truncation Warnings: Introduced bootstrap truncation warnings that can be injected into the agent's prompt when context files exceed size limits. A new configuration option, agents.defaults.bootstrapPromptTruncationWarning, allows control over warning behavior (off, once, or always), with 'once' as the default.
  • Bug Fix: Localized Console Timestamps: Resolved an issue where console timestamps were rendered in UTC. They now consistently use local timezone formatting across 'pretty' and timestamp-prefix outputs.
  • Bug Fix: Security Header for Media Responses: Added the X-Content-Type-Options: nosniff security header to media responses to prevent MIME type sniffing vulnerabilities.
  • Documentation Updates: Updated relevant guides and configuration references to reflect the new bootstrap truncation warning behavior and its configuration details.
Changelog
Activity
  • Automated sync of upstream changes from upstream/main.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is an automated upstream sync, bringing in a large number of changes including new features, bug fixes, and documentation updates. Key improvements include refactoring UI components for better code reuse, enhancing thread safety in iOS/macOS code with proper locking, and migrating webhook handling in several plugins to a more robust, standardized pipeline. I've reviewed the changes and they are generally high quality. I have one minor suggestion in extensions/feishu/src/bot.ts to improve the mention normalization logic by adjusting how whitespace is handled, which will make it more predictable.

Note: Security Review did not run due to the size of the PR.

I am having trouble creating individual review comments. Click here to see my feedback.

extensions/feishu/src/bot.ts (500-503)

medium

Calling .trim() inside the loop for each mention replacement can lead to unintended removal of whitespace, especially between adjacent mentions. It's also slightly inefficient. It would be cleaner and safer to perform all replacements first and then trim the final result once before returning.

    result = result.replace(new RegExp(escaped(mention.key), "g"), () => replacement);
  }

  return result.trim();

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.