Skip to content

fix(agent): resolve gadget callbacks without heavy executor scans - #25

Open
darjss wants to merge 2 commits into
fix/executor-concurrency-capsfrom
fix/agent-callback-resolve-fast
Open

fix(agent): resolve gadget callbacks without heavy executor scans#25
darjss wants to merge 2 commits into
fix/executor-concurrency-capsfrom
fix/agent-callback-resolve-fast

Conversation

@darjss

@darjss darjss commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Why

Dashboard onGadgetChat callbacks blocked on the agent for up to 113s because the agent re-fetched live erxes data on every chat message. Workers RPC waits approach ~180s.

Scope

  • packages/workshop-backend/src/agent.ts: agentCallback replay prompt tells the agent to resolve from callback args without EXECUTOR unless live data is required. Target under 30 seconds.

Blast Radius

Agent prompt only. Affects gadget chat callbacks, not normal user messages.

Verification

Prompt string change only; no automated test for replay text.

Summary by Sourcery

Resolve gadget callbacks promptly without invoking executor tools unless live data is required.

Bug Fixes:

  • Speed up gadget chat callback handling by resolving from callback arguments and existing request context before fetching live data.
  • Prevent executor tools from being available during callback-initiated agent turns, avoiding unnecessary executor scans.

@sourcery-ai

sourcery-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the agent’s callback replay prompt so gadget chat callbacks resolve from supplied arguments without expensive executor scans unless live data is necessary, reducing callback latency while leaving normal user-message behavior unchanged.

Sequence diagram for fast gadget callback resolution

sequenceDiagram
    participant Gadget
    participant Agent
    participant Callback
    participant EXECUTOR

    Gadget->>Agent: agentCallback(args)
    Agent->>Agent: Resolve from callback args and request context
    alt live data required
        Agent->>EXECUTOR: Fetch required live data
        EXECUTOR-->>Agent: Return data
    end
    Agent->>Callback: env.name.resolve(value) or env.name.reject(error)
    Callback-->>Gadget: Callback completed
Loading

File-Level Changes

Change Details Files
Optimize gadget chat callback replay instructions to favor fast resolution from existing callback context.
  • Directs the agent to use callback arguments and request context first.
  • Restricts EXECUTOR and other heavy bindings to cases requiring unavailable live data.
  • Adds an under-30-second completion target for gadget chat callbacks.
packages/workshop-backend/src/agent.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

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

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: defaults

Review profile: CHILL

Plan: Team

Run ID: ae7fec02-3cd4-4754-8486-c77b2f569de1

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.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@github-actions github-actions Bot added the kernel label Sep 1, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@darjss
darjss force-pushed the fix/executor-concurrency-caps branch from 7a4df34 to 9ca67a9 Compare September 1, 2026 08:14
@darjss
darjss force-pushed the fix/agent-callback-resolve-fast branch from 69720dc to 2d2db2c Compare September 1, 2026 08:14
Use shared executor tool names in callback guidance and skip registering
executor tools when the turn exists only to resolve gadget callbacks.
@darjss
darjss force-pushed the fix/agent-callback-resolve-fast branch from 2d2db2c to 93fba53 Compare September 1, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant