Skip to content

fix(evi): inline dynamic tool executes so resumed sessions keep their tools - #551

Merged
HugoRCD merged 5 commits into
mainfrom
fix/evi-dynamic-step-registration
Aug 10, 2026
Merged

fix(evi): inline dynamic tool executes so resumed sessions keep their tools#551
HugoRCD merged 5 commits into
mainfrom
fix/evi-dynamic-step-registration

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Production logs from this morning's scheduled runs show the failure eve's docs warn about:

[eve:dynamic-tools] Dynamic tool "ai_gateway__credits" references step function
"eve:framework-dynamic:ai-gateway:ai_gateway__credits" which is not registered

All five dynamic tool files built their tool maps through factory functions; eve's bundler transform only registers execute step functions it finds inline in the resolver body, so on a resumed session (the long-lived iMessage thread permanently is one) the tools stopped executing and the model degraded to answering around them.

  • ai-gateway, git, blob, capture, turbo: the tool maps now sit inline in a single turn.started resolver (which also covers what session.started did, once per turn instead of once per session).
  • createPullRequest policy: a schedule-app turn creating a draft PR no longer parks on an approval card — a draft cannot merge, and marking one ready stays a human act. Non-draft keeps the card. This matches the original upstream-sync contract ("one or more draft PRs, nothing auto-applicable").
  • Both schedule prompts now tell the turn to ignore earlier conversation topics and stale pending requests: scheduled turns resume the shared thread session, and this morning's runs showed the context bleed.

No changeset: confined to apps/evi. Verified: tsc, 63 unit tests, eve build. The step-registration warning disappearing from production logs after deploy is the end-to-end check.

Summary by CodeRabbit

  • Bug Fixes

    • Scheduled draft pull requests now correctly bypass approval when authorized by scheduled automation.
    • Daily digest and upstream synchronization tasks no longer carry over stale requests or unrelated conversation topics.
    • Administrative tools now remain available only in authorized sessions, with access checks enforced during use.
  • Security

    • Git, blob upload, capture, Turbo cache, and administrative tools now apply more consistent access controls.
  • Documentation

    • Added guidance for reliable tool behavior in resumed sessions.

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
evi Ready Ready Preview Aug 10, 2026 8:03am
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
evlog-docs Skipped Skipped Aug 10, 2026 8:03am
evlog-render-lab Skipped Skipped Aug 10, 2026 8:03am
evlog-telemetry Skipped Skipped Aug 10, 2026 8:03am
just-use-evlog Skipped Skipped Aug 10, 2026 8:03am

Request Review

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 89edeb8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@HugoRCD, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6643ebd2-c69a-4751-a4bb-90e941703c67

📥 Commits

Reviewing files that changed from the base of the PR and between 31771d2 and 89edeb8.

📒 Files selected for processing (5)
  • apps/evi/agent/tools/ai-gateway.ts
  • apps/evi/agent/tools/blob.ts
  • apps/evi/agent/tools/capture.ts
  • apps/evi/agent/tools/git.ts
  • apps/evi/agent/tools/turbo.ts
📝 Walkthrough

Walkthrough

The PR updates scheduled GitHub approval and prompt handling. It moves dynamic tools from session-startup factories to authorization-gated definitions resolved during turn.started.

Changes

Scheduled execution and tool access

Layer / File(s) Summary
Scheduled approval and prompt handling
apps/evi/agent/extensions/github.ts, apps/evi/agent/schedules/digest.ts, apps/evi/agent/schedules/upstream-sync.ts
Draft pull requests from scheduled app authentication bypass approval. Scheduled prompts ignore earlier topics and stale requests.
Turn-scoped admin tool registration
apps/evi/agent/tools/ai-gateway.ts, apps/evi/agent/tools/blob.ts, apps/evi/agent/tools/capture.ts, apps/evi/agent/tools/turbo.ts, apps/evi/docs/notes.md
Admin tools now register inline during turn.started only for authorized sessions. Tool execution performs additional authorization checks. Capture execution uses the turn tool context. The inline resolver requirement is documented.
Maintainer and schedule-app Git access
apps/evi/agent/tools/git.ts
The Git push tool now registers during turn.started for maintainer and schedule-app sessions. Push authorization and repository operations remain unchanged.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Session
  participant TurnStarted
  participant canAccessAdminTools
  participant DynamicTools
  Session->>TurnStarted: Start turn
  TurnStarted->>canAccessAdminTools: Check session access
  canAccessAdminTools-->>TurnStarted: Return authorization
  TurnStarted->>DynamicTools: Define authorized tools inline
  DynamicTools->>canAccessAdminTools: Recheck access during execution
Loading

Possibly related PRs

  • HugoRCD/evlog#522: Introduces the isScheduleAppAuth helper reused by this PR.
  • HugoRCD/evlog#531: Modifies dynamic tool registration and authorization in the same EVI tool files.
  • HugoRCD/evlog#534: Modifies dynamic capture tool authorization and turn.started resolution.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Evi dynamic-tool fix and explains the resumed-session outcome.
Description check ✅ Passed The description clearly explains the failure, implementation, related behavior changes, and verification; only optional template items are absent.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/evi-dynamic-step-registration

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.

@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@evlog/cli@551
npm i https://pkg.pr.new/evlog@551
npm i https://pkg.pr.new/@evlog/nuxthub@551
npm i https://pkg.pr.new/@evlog/telemetry@551

commit: 89edeb8

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/evi/agent/tools/capture.ts (1)

72-84: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Require approval when approvalCtx.toolInput is missing.

toolInput is optional in the Eve approval context, so approvalCtx.toolInput?.beforeUrl can skip sensitivity inspection for both URLs when toolInput is undefined. That path returns 'not-applicable' and can publish public-captured screens without an approval card. Fail closed by returning 'user-approval' before inspecting beforeUrl/afterUrl.

</verification Result>

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/evi/agent/tools/capture.ts` around lines 72 - 84, Update the approval
callback around approvalCtx.toolInput to return 'user-approval' immediately when
toolInput is missing, before iterating over beforeUrl and afterUrl. Preserve the
existing URL sensitivity checks and 'not-applicable' result when toolInput is
present and neither URL requires approval.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/evi/agent/tools/ai-gateway.ts`:
- Around line 79-86: Remove the implementation-history clause about
factory-built maps breaking resumed-session tool execution from the comments at
apps/evi/agent/tools/ai-gateway.ts lines 79-86, apps/evi/agent/tools/blob.ts
lines 9-13, apps/evi/agent/tools/capture.ts lines 48-54, and
apps/evi/agent/tools/turbo.ts lines 10-14. Preserve the durable
inline-definition constraint in all four comments, the bare-tool-name note in
ai-gateway.ts, and the public-URL constraint in capture.ts.

In `@apps/evi/agent/tools/blob.ts`:
- Around line 24-31: Re-check canAccessAdminTools inside execute for every
turn-scoped admin tool, preserving the existing checks in capture.ts and
turbo.ts. In apps/evi/agent/tools/blob.ts lines 24-31, make it the first execute
statement and return the specified unavailable-session error when unauthorized;
in apps/evi/agent/tools/ai-gateway.ts lines 92-98, add the same check to
ai_gateway__credits, ai_gateway__report, and ai_gateway__generation, adding
toolCtx to each execute signature.

In `@apps/evi/agent/tools/turbo.ts`:
- Line 40: Wrap the exchangeTurboToken call in the tool function’s existing
error-handling flow so rejected exchanges do not expose the upstream response
body. Return the same structured { success: false } result used by the other
failure branches, matching the handling already applied to getVercelOidcToken.

---

Outside diff comments:
In `@apps/evi/agent/tools/capture.ts`:
- Around line 72-84: Update the approval callback around approvalCtx.toolInput
to return 'user-approval' immediately when toolInput is missing, before
iterating over beforeUrl and afterUrl. Preserve the existing URL sensitivity
checks and 'not-applicable' result when toolInput is present and neither URL
requires approval.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ea25ff60-e714-4fab-ad58-13bca31bfb50

📥 Commits

Reviewing files that changed from the base of the PR and between 9eb98cf and 26dc149.

📒 Files selected for processing (8)
  • apps/evi/agent/extensions/github.ts
  • apps/evi/agent/schedules/digest.ts
  • apps/evi/agent/schedules/upstream-sync.ts
  • apps/evi/agent/tools/ai-gateway.ts
  • apps/evi/agent/tools/blob.ts
  • apps/evi/agent/tools/capture.ts
  • apps/evi/agent/tools/git.ts
  • apps/evi/agent/tools/turbo.ts

Comment thread apps/evi/agent/tools/ai-gateway.ts Outdated
Comment thread apps/evi/agent/tools/blob.ts
Comment thread apps/evi/agent/tools/turbo.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-render-lab August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-render-lab August 10, 2026 07:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-render-lab August 10, 2026 07:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry August 10, 2026 07:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs August 10, 2026 07:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog August 10, 2026 07:58 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/evi/agent/tools/git.ts`:
- Line 18: Update the comment near the inline resolver execution to state the
durable requirement directly: instruct maintainers to keep execute inline in the
resolver, while retaining the reference to docs/notes.md. Remove the
implementation-history wording “on purpose.”
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 49090d7a-da72-4cf1-bbd4-79053f8f7be4

📥 Commits

Reviewing files that changed from the base of the PR and between 31ee3fe and 31771d2.

📒 Files selected for processing (4)
  • apps/evi/agent/tools/ai-gateway.ts
  • apps/evi/agent/tools/blob.ts
  • apps/evi/agent/tools/git.ts
  • apps/evi/agent/tools/turbo.ts

Comment thread apps/evi/agent/tools/git.ts Outdated
@HugoRCD HugoRCD assigned HugoRCD and unassigned HugoRCD Aug 10, 2026
@vercel
vercel Bot temporarily deployed to Preview – evlog-render-lab August 10, 2026 08:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry August 10, 2026 08:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs August 10, 2026 08:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog August 10, 2026 08:02 Inactive
@HugoRCD
HugoRCD merged commit d323963 into main Aug 10, 2026
18 checks passed
@HugoRCD
HugoRCD deleted the fix/evi-dynamic-step-registration branch August 10, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant