Skip to content

Surface#1007

Merged
devxpy merged 1 commit into
masterfrom
surface
Jun 13, 2026
Merged

Surface#1007
devxpy merged 1 commit into
masterfrom
surface

Conversation

@devxpy

@devxpy devxpy commented Jun 13, 2026

Copy link
Copy Markdown
Member

…api_call field, filter history and builder conversations by surface

Q/A checklist

  • I have tested my UI changes on mobile and they look acceptable
  • I have tested changes to the workflows in both the API and the UI
  • I have done a code review of my changes and looked at each line of the diff + the references of each function I have changed
  • My changes have not increased the import time of the server
How to check import time?

time python -c 'import server'

You can visualize this using tuna:

python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@devxpy, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 44 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1de2b88d-dceb-4ddd-9c25-65a34966236b

📥 Commits

Reviewing files that changed from the base of the PR and between 8c2c578 and 4e9b6b6.

📒 Files selected for processing (23)
  • bots/admin.py
  • bots/migrations/0121_savedrun_surface_alter_savedrun_is_api_call.py
  • bots/models/published_run.py
  • bots/models/saved_run.py
  • bots/tasks.py
  • celeryapp/tasks.py
  • daras_ai_v2/base.py
  • daras_ai_v2/bot_integration_widgets.py
  • daras_ai_v2/bots.py
  • daras_ai_v2/breadcrumbs.py
  • daras_ai_v2/gooey_builder.py
  • daras_ai_v2/safety_checker.py
  • functions/gooey_builder_workflow_tools.py
  • functions/workflow_tools.py
  • livekit_agent.py
  • recipes/BulkRunner.py
  • recipes/ModelTrainer.py
  • recipes/VideoBotsStats.py
  • routers/api.py
  • routers/twilio_api.py
  • widgets/demo_button.py
  • widgets/workflow_bulk_runs_list.py
  • widgets/workflow_image.py
📝 Walkthrough

Walkthrough

This pull request introduces a Surface enum to the SavedRun model to classify the origin of workflow runs, replacing the binary is_api_call boolean field. The enum defines ten surface values: run, api, deployment, builder_prompt, builder_child, tool_call, internal, analysis, export, and bulk. The corresponding Django migration adds the field and deprecates the old boolean. All call sites throughout the codebase are updated to explicitly tag runs with the appropriate surface value based on their origin context—API routes default to api, deployment integrations use deployment, builder flows use builder_prompt/builder_child, tool execution uses tool_call, and various internal services use internal, analysis, export, or bulk. History filtering and breadcrumb display logic are updated to use surface instead of is_api_call for determining visibility and labels.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Surface' is extremely vague and does not convey meaningful information about the changeset. Use a more descriptive title that indicates the main change, such as 'Add surface field to SavedRun to replace is_api_call'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description follows the required template and includes all major sections, though all Q/A checklist items are unchecked.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c2c578e6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bots/migrations/0121_savedrun_surface_alter_savedrun_is_api_call.py
…api_call field, filter history and builder conversations by surface

@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.

Caution

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

⚠️ Outside diff range comments (1)
daras_ai_v2/base.py (1)

2360-2372: ⚠️ Potential issue | 🟠 Major

Fix/extend legacy SavedRun.surface backfill before using surface-only history filtering

bots/migrations/0121_savedrun_surface_alter_savedrun_is_api_call.py adds surface with default SavedRun.Surface.run and backfills only rows where is_api_call=Truesurface=SavedRun.Surface.api. Existing rows that represent non-API origins (including deployments and builder prompts) will therefore remain Surface.run.

if (
    for_param != "all"
    and self.request.user
    and not self.current_workspace.is_personal
):
    qs = qs.filter(uid=self.request.user.uid).exclude(
        surface=SavedRun.Surface.deployment
    )

This can misclassify historical deployment/builder-prompt runs in the history view because the filters in daras_ai_v2/base.py exclude by surface (deployment / builder_prompt). Add additional migration backfill logic (or derive missing categories from legacy fields) so pre-existing data matches the intended surface values.

🤖 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 `@daras_ai_v2/base.py` around lines 2360 - 2372, The history filtering
misclassifies legacy rows because SavedRun.surface was only partially backfilled
by the migration that set surface from is_api_call; update data backfill or
derive surfaces before filtering: add a new data migration (or extend the
existing backfill) that sets SavedRun.surface for legacy rows based on existing
legacy flags/columns (e.g., set surface = SavedRun.Surface.api when
is_api_call=True, surface = SavedRun.Surface.deployment for rows with the
deployment indicator, surface = SavedRun.Surface.builder_prompt for
builder_prompt indicator, otherwise surface = SavedRun.Surface.run), and then
ensure the code path in the view (the block that references self.request.user,
self.current_workspace, and filters/excludes by SavedRun.Surface.deployment and
SavedRun.Surface.builder_prompt) relies on that completed backfill;
alternatively, if you cannot run a migration immediately, update the view to
compute an inferred surface for filtering (using the same legacy columns) before
applying .exclude(surface=...) so historical records are classified correctly.
🧹 Nitpick comments (1)
bots/models/saved_run.py (1)

146-160: ⚡ Quick win

Consider adding a database index for the surface field.

The surface field is used in admin filtering (line 462 in bots/admin.py) and the review context indicates surface-based filtering will be common. A composite index would improve query performance for typical admin filters.

🔍 Suggested index to add to the indexes list
 indexes = [
     models.Index(fields=["-created_at"]),
     models.Index(fields=["-updated_at"]),
     models.Index(fields=["workflow"]),
+    models.Index(fields=["workflow", "surface", "-updated_at"]),
     models.Index(fields=["uid"]),
🤖 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 `@bots/models/saved_run.py` around lines 146 - 160, The surface IntegerField in
the SavedRun model lacks a DB index, hurting admin filtering; update the field
definition for surface in bots/models/saved_run.py to add db_index=True (e.g.,
surface = models.IntegerField(..., db_index=True)) and also add a Meta.indexes
entry on the SavedRun model with models.Index(fields=['surface'],
name='savedrun_surface_idx') so queries and admin filters using surface are
served by an index.
🤖 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.

Outside diff comments:
In `@daras_ai_v2/base.py`:
- Around line 2360-2372: The history filtering misclassifies legacy rows because
SavedRun.surface was only partially backfilled by the migration that set surface
from is_api_call; update data backfill or derive surfaces before filtering: add
a new data migration (or extend the existing backfill) that sets
SavedRun.surface for legacy rows based on existing legacy flags/columns (e.g.,
set surface = SavedRun.Surface.api when is_api_call=True, surface =
SavedRun.Surface.deployment for rows with the deployment indicator, surface =
SavedRun.Surface.builder_prompt for builder_prompt indicator, otherwise surface
= SavedRun.Surface.run), and then ensure the code path in the view (the block
that references self.request.user, self.current_workspace, and filters/excludes
by SavedRun.Surface.deployment and SavedRun.Surface.builder_prompt) relies on
that completed backfill; alternatively, if you cannot run a migration
immediately, update the view to compute an inferred surface for filtering (using
the same legacy columns) before applying .exclude(surface=...) so historical
records are classified correctly.

---

Nitpick comments:
In `@bots/models/saved_run.py`:
- Around line 146-160: The surface IntegerField in the SavedRun model lacks a DB
index, hurting admin filtering; update the field definition for surface in
bots/models/saved_run.py to add db_index=True (e.g., surface =
models.IntegerField(..., db_index=True)) and also add a Meta.indexes entry on
the SavedRun model with models.Index(fields=['surface'],
name='savedrun_surface_idx') so queries and admin filters using surface are
served by an index.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b1155aec-5917-43c8-9eab-8cae72b12078

📥 Commits

Reviewing files that changed from the base of the PR and between 4e38d2e and 8c2c578.

📒 Files selected for processing (23)
  • bots/admin.py
  • bots/migrations/0121_savedrun_surface_alter_savedrun_is_api_call.py
  • bots/models/published_run.py
  • bots/models/saved_run.py
  • bots/tasks.py
  • celeryapp/tasks.py
  • daras_ai_v2/base.py
  • daras_ai_v2/bot_integration_widgets.py
  • daras_ai_v2/bots.py
  • daras_ai_v2/breadcrumbs.py
  • daras_ai_v2/gooey_builder.py
  • daras_ai_v2/safety_checker.py
  • functions/gooey_builder_workflow_tools.py
  • functions/workflow_tools.py
  • livekit_agent.py
  • recipes/BulkRunner.py
  • recipes/ModelTrainer.py
  • recipes/VideoBotsStats.py
  • routers/api.py
  • routers/twilio_api.py
  • widgets/demo_button.py
  • widgets/workflow_bulk_runs_list.py
  • widgets/workflow_image.py

@devxpy devxpy merged commit 4cd6c24 into master Jun 13, 2026
8 checks passed
@devxpy devxpy deleted the surface branch June 13, 2026 04:54
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.

1 participant