Skip to content

[feat] Stop evicting warm sessions when an integration is added - #6368

Merged
mmabrouk merged 1 commit into
release/v0.114.4from
feat/gateway-guidance-field
Aug 31, 2026
Merged

[feat] Stop evicting warm sessions when an integration is added#6368
mmabrouk merged 1 commit into
release/v0.114.4from
feat/gateway-guidance-field

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Adding a second integration to an agent evicted its warm session, twice over. The integration names were written into the prompt guidance ("Configured integrations: github, slack.") and into the search_tools tool description, and both surfaces are hashed into the session fingerprint. So a one-word list change cost a full sandbox rebuild, fresh Daytona Secrets, and a pass through the substitution race of #6362. Editing an integration's tool permissions was already fine: gatewayPolicy sits outside the fingerprint.

Changes

The guidance becomes its own wire field, and the names become examples.

Before: the SDK adapter spliced the guidance into appendSystemPrompt (Pi) or agentsMd (Claude, Codex), and the runner hashed the result.

After: the wire carries gatewayGuidance: {text, carrier}. The adapters keep the carrier choice but stop splicing, so the prompt strings leave the SDK purely authored. The runner splices guidance-first when it builds an environment (buildRunPlan), and configFingerprint plus the desired-state facets exclude the field by design, with the reason documented at both sites. The text refreshes exactly when a session is built, and never evicts one.

The wording changes with it: "For instance, some of the integrations you have: github, slack. Others may exist, and this list can go stale — search_tools is the source of truth." A list that goes stale mid-session is now honest.

The derived search_tools / run_tool descriptions drop their names sentence and are byte-identical for any integration set. So only the first connection, which genuinely adds the two tools, changes session config at all.

Tests

  • SDK: agents suite green (1131 passed). The gateway adapter tests now pin the field form, the stable tool descriptions, and the example wording; the golden run_request.gateway_connection.json pins the new field. Connection-free payloads are byte-identical to before.
  • Runner: 156 files / 2569 tests green, typecheck clean. New cases: the splice (guidance-first, both carriers, guidance-alone), and a fingerprint test proving two requests differing only in gatewayGuidance hash equal.

What to QA

  • On a warm Daytona session with one integration connected, add a second integration, then send another turn. The turn starts fast (no rebuild), and the agent can use the new integration through search_tools immediately; its prompt still names only the first until the next cold start.
  • Regression: a fresh session with integrations gets the guidance section with the integration names; an agent with no integrations gets no gateway text anywhere.

Stacked on #6367.

https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 31, 2026 3:46pm

Request Review

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 29, 2026
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

📘 Docs preview

Status ✅ Ready
Preview https://pr-6368-agenta-docs-preview.mahmoud-637.workers.dev/docs
Inspect Actions run
Commit 3c21ca2319ea862c33eb959275e0e3d1093643f0

This comment updates in place on every push.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • release/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ef18b57-33a2-4553-a46b-4291600db1f2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@mmabrouk mmabrouk added lgtm This PR has been approved by a maintainer and removed enhancement New feature or request labels Aug 31, 2026

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lgtm

Adding a second integration to an agent evicted its warm session twice
over: the integration names were composed into the prompt strings
(appendSystemPrompt for Pi, agentsMd for the file-based harnesses) and
into the search_tools tool description, and both surfaces are part of
the session fingerprint. A one-word list change cost a full sandbox
rebuild, fresh Daytona Secrets, and the substitution race of #6362.

Now the guidance rides the wire as gatewayGuidance {text, carrier}:
- the SDK adapters keep the carrier choice but stop splicing; the
  prompt strings leave the adapter purely authored;
- the runner splices guidance-first at environment build (buildRunPlan),
  so the text refreshes exactly when a session is built and never evicts
  one: configFingerprint and the desired-state facets exclude the field
  by design, with the reason documented at both sites;
- the wording presents the names as examples ('For instance, some of
  the integrations you have: ... Others may exist, and this list can go
  stale — search_tools is the source of truth'), so a list that goes
  stale mid-session stays honest;
- the derived search_tools/run_tool descriptions drop the names sentence
  and are now byte-identical for any integration set, so only the FIRST
  connection (which genuinely adds the two tools) changes session config.

Golden run_request.gateway_connection.json pins the new field; the
connection-free payloads are byte-identical to before.

Claude-Session: https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt
@mmabrouk
mmabrouk force-pushed the chore/remove-pi-agenta branch from fa9b103 to 2c96b8e Compare August 31, 2026 15:44
@mmabrouk
mmabrouk force-pushed the feat/gateway-guidance-field branch from b1503f1 to 3c21ca2 Compare August 31, 2026 15:44
@mmabrouk
mmabrouk changed the base branch from chore/remove-pi-agenta to release/v0.114.4 August 31, 2026 16:36
@mmabrouk
mmabrouk merged commit 427af5d into release/v0.114.4 Aug 31, 2026
48 of 49 checks passed
@mmabrouk mmabrouk mentioned this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant