Skip to content

fix(copilot): send api key to sim agent#1142

Merged
Sg312 merged 2 commits intostagingfrom
fix/copilot-keygen
Aug 26, 2025
Merged

fix(copilot): send api key to sim agent#1142
Sg312 merged 2 commits intostagingfrom
fix/copilot-keygen

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Aug 26, 2025

Summary

Sends api key to sim agent in request

Type of Change

  • Bug fix

Testing

How has this been tested? What should reviewers focus on?

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

@vercel
Copy link

vercel bot commented Aug 26, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 26, 2025 9:48pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 26, 2025 9:48pm

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.

Greptile Summary

This PR fixes a bug in the copilot API key management system by adding proper authentication to requests made to the external sim agent service. The change adds a conditional x-api-key header to both GET and DELETE operations in the copilot API keys route, using the COPILOT_API_KEY environment variable when available.

The fix resolves authentication failures when the copilot feature attempts to validate API keys through the agent.sim.ai service. Previously, these requests were being made without authentication, causing them to fail with unauthorized errors. The implementation uses a spread operator pattern to conditionally include the header only when the environment variable is configured, maintaining backward compatibility.

As a result of this authentication fix, the README.md documentation has been updated to remove the requirement for self-hosted instances to use publicly available DNS when using copilot features. This simplifies the self-hosting setup process by eliminating the need for services like ngrok to expose the local instance publicly, which was likely necessary for webhook-based authentication patterns that are no longer required.

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it addresses a clear authentication bug
  • Score reflects a straightforward bug fix with proper conditional logic and backward compatibility
  • Pay close attention to the environment variable configuration to ensure COPILOT_API_KEY is properly set in production

2 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs August 26, 2025 21:43 Inactive
@Sg312 Sg312 merged commit 78437c6 into staging Aug 26, 2025
5 checks passed
waleedlatif1 pushed a commit that referenced this pull request Aug 27, 2025
waleedlatif1 added a commit that referenced this pull request Aug 27, 2025
…is for queueing docs in kb (#1143)

* improvement(kb): created knowledge, chunks, tags services and use redis for queueing docs in kb

* moved directories around

* cleanup

* bulk create docuemnt records after upload is completed

* fix(copilot): send api key to sim agent (#1142)

* Fix api key auth

* Lint

* ack PR comments

* added sort by functionality for headers in kb table

* updated

* test fallback from redis, fix styling

* cleanup copilot, fixed tooltips

* feat: local auto layout (#1144)

* feat: added llms.txt and robots.txt (#1145)

* fix(condition-block): edges not following blocks, duplicate issues (#1146)

* fix(condition-block): edges not following blocks, duplicate issues

* add subblock update to setActiveWorkflow

* Update apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/condition-input.tsx

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix dependency array

* fix(copilot-cleanup): support azure blob upload in copilot, remove dead code & consolidate other copilot files (#1147)

* cleanup

* support azure blob image upload

* imports cleanup

* PR comments

* ack PR comments

* fix key validation

* improvement(forwarding+excel): added forwarding and improve excel read (#1136)

* added forwarding for outlook

* lint

* improved excel sheet read

* addressed greptile

* fixed bodytext getting truncated

* fixed any type

* added html func

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>

* revert agent const

* update docs

---------

Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com>
Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
@waleedlatif1 waleedlatif1 deleted the fix/copilot-keygen branch August 27, 2025 06:12
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…is for queueing docs in kb (simstudioai#1143)

* improvement(kb): created knowledge, chunks, tags services and use redis for queueing docs in kb

* moved directories around

* cleanup

* bulk create docuemnt records after upload is completed

* fix(copilot): send api key to sim agent (simstudioai#1142)

* Fix api key auth

* Lint

* ack PR comments

* added sort by functionality for headers in kb table

* updated

* test fallback from redis, fix styling

* cleanup copilot, fixed tooltips

* feat: local auto layout (simstudioai#1144)

* feat: added llms.txt and robots.txt (simstudioai#1145)

* fix(condition-block): edges not following blocks, duplicate issues (simstudioai#1146)

* fix(condition-block): edges not following blocks, duplicate issues

* add subblock update to setActiveWorkflow

* Update apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/condition-input.tsx

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix dependency array

* fix(copilot-cleanup): support azure blob upload in copilot, remove dead code & consolidate other copilot files (simstudioai#1147)

* cleanup

* support azure blob image upload

* imports cleanup

* PR comments

* ack PR comments

* fix key validation

* improvement(forwarding+excel): added forwarding and improve excel read (simstudioai#1136)

* added forwarding for outlook

* lint

* improved excel sheet read

* addressed greptile

* fixed bodytext getting truncated

* fixed any type

* added html func

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>

* revert agent const

* update docs

---------

Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com>
Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
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