Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow absolute paths if contained in workspace #3932

Conversation

BaseInfinity
Copy link
Contributor

@BaseInfinity BaseInfinity commented May 6, 2023

Background

Maybe I'm missing something but I don't see the harm of accessing an absolute path if it's contained in the workspace

Changes

Instead of blindly erroring on absolute paths, let's make an exception if they are contained in the workspace

Documentation

Simple one line change with a clear comment is there

Test Plan

Besides not running into this issue that reported here after my changes:
#3705

I've also instructed the AI to write to absolute paths in my workspace, and try to write to an absolute path outside of the workspace, as well as relative paths inside and outside workspaces

  • Write "hello" to file path "/Users/stefanayala"
  • Write "hello" to file path "/Users/stefanayala/baseAutoGPT/autogpt/auto_gpt_workspace"
  • Write "hello" using a relative path to the autogpt workspace
  • Write "hello" to relative path ~/

Here are the results:
Screen Shot 2023-05-06 at 4 30 21 PM
Screen Shot 2023-05-06 at 4 29 42 PM
Screen Shot 2023-05-06 at 4 23 48 PM

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

I haven't added tests yet because I'm not sure if this is behavior we want, if this is wanted behavior then I'll go ahead and write a test for this

Closes #3705

Maybe I'm missing something but I don't see the harm of accessing an absolute path if it's contained in the workspace
@vercel
Copy link

vercel bot commented May 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2023 2:05pm

@vercel vercel bot temporarily deployed to Preview May 12, 2023 23:52 Inactive
@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (0839a16) 62.18% compared to head (ee1abe7) 62.18%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3932   +/-   ##
=======================================
  Coverage   62.18%   62.18%           
=======================================
  Files          73       73           
  Lines        3345     3345           
  Branches      484      484           
=======================================
  Hits         2080     2080           
  Misses       1118     1118           
  Partials      147      147           
Impacted Files Coverage Δ
autogpt/workspace/workspace.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Boostrix Boostrix requested a review from collijk May 16, 2023 13:17
@Boostrix Boostrix added this to the v0.3.2 Release milestone May 16, 2023
@vercel vercel bot temporarily deployed to Preview May 16, 2023 14:05 Inactive
@k-boikov k-boikov merged commit c1cd54d into Significant-Gravitas:master May 16, 2023
@GoZippy
Copy link

GoZippy commented May 17, 2023

thanks!

ppetermann pushed a commit to ppetermann/Auto-GPT that referenced this pull request May 22, 2023
…3932)

Maybe I'm missing something but I don't see the harm of accessing an absolute path if it's contained in the workspace

Co-authored-by: k-boikov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Bug?: Attempted to access absolute path....in my own workspace
4 participants