Skip to content

Conversation

@joshsny
Copy link
Contributor

@joshsny joshsny commented Oct 3, 2025

Problem

We will be running tasks in a sandbox environment, the existing temporal workflow was running within the temporal worker.

Changes

Added a temporal workflow for executing the tasks in a sandbox environment, it follows the following flow:

  1. Get task details (repository, team, user)
  2. Check if snapshot exists for repository
    • If exists: Use existing snapshot
    • If not: Create new one
      a. Provision sandbox for setup
      b. Clone repository
      c. Run setup commands (install dependencies)
      d. Create snapshot for reuse
      e. Cleanup setup sandbox
  3. Create sandbox from snapshot
  4. Inject credentials into sandbox
    • Inject GitHub token
    • Create and inject personal API key
  5. Execute task in sandbox
  6. Cleanup
    • Destroy sandbox
    • Delete personal API key

@joshsny joshsny changed the title Array/sandbox snapshot activities feat(array): temporal workflow for sandbox environment Oct 3, 2025
@joshsny joshsny requested a review from Copilot October 3, 2025 16:32
@joshsny joshsny marked this pull request as ready for review October 6, 2025 08:47
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (2)

  1. products/tasks/backend/models.py, line 270 (link)

    logic: Using dict() as default can cause shared mutable state issues. Consider using None as default

    Context Used: Context from dashboard - Use 'None' as the default value for JSONField in models instead of 'dict()' to avoid creating a new ... (source)

  2. products/tasks/backend/models.py, line 512 (link)

    logic: Using dict() as default can cause shared mutable state issues. Consider using None as default

    Context Used: Context from dashboard - Use 'None' as the default value for JSONField in models instead of 'dict()' to avoid creating a new ... (source)

47 files reviewed, 35 comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@k11kirky k11kirky left a comment

Choose a reason for hiding this comment

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

Took a light scan of this - mostly looks good to me. We need to go back and make sure we clean up all of the files for workflows once we merge this and its working

@joshsny joshsny enabled auto-merge (squash) October 7, 2025 11:32
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

Migration SQL Changes

Hey 👋, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:

products/tasks/backend/migrations/0009_task_created_by.py

BEGIN;
--
-- Add field created_by to task
--
ALTER TABLE "posthog_task" ADD COLUMN "created_by_id" integer NULL CONSTRAINT "posthog_task_created_by_id_a5ef3d92_fk_posthog_user_id" REFERENCES "posthog_user"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "posthog_task_created_by_id_a5ef3d92_fk_posthog_user_id" IMMEDIATE;
COMMIT;

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

🔍 Migration Risk Analysis

We've analyzed your migrations for potential risks.

Summary: 1 Safe | 0 Needs Review | 0 Blocked

✅ Safe

No locks, backwards compatible

tasks.0009_task_created_by
  └─ #1 ✅ AddField
     Adding nullable field is safe
     model: task, field: created_by

@joshsny joshsny merged commit 06d2335 into master Oct 7, 2025
184 checks passed
@joshsny joshsny deleted the array/sandbox-snapshot-activities branch October 7, 2025 14:57
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.

3 participants