Repository navigation
examples: add AgentFS-backed filesystem demo - #755
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 913853f7f9
ℹ️ 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".
| } | ||
| } | ||
|
|
||
| file, err := f.afs.FS.Open(ctx, abs, openFlags(flag)) |
There was a problem hiding this comment.
Honor requested mode when creating files
OpenFile takes a perm argument but the create path never applies it: the code opens with flags only and does not Chmod newly created files. As a result, callers that depend on explicit creation modes (for example mktemp creating files with 0o600) can end up with backend-default permissions instead of the requested mode, which breaks filesystem semantics and can weaken temp-file privacy.
Useful? React with 👍 / 👎.
|
|
||
| func (f *FileSystem) Link(ctx context.Context, oldName, newName string) error { | ||
| oldAbs := f.resolve(oldName) | ||
| stats, err := f.afs.FS.Stat(ctx, oldAbs) |
There was a problem hiding this comment.
Validate hard-link source with Lstat, not Stat
This lookup dereferences oldName before validating the source, so Link can mis-handle symlink sources: a symlink to a directory is rejected as ErrInvalid, and a dangling symlink can fail with not-exist, even though hard-linking the symlink itself is a valid operation in gbash’s other filesystem backends. Using Lstat for the pre-check keeps ln behavior consistent for symlink inputs.
Useful? React with 👍 / 👎.
Summary
agentfs-backed-fsexample that uses the upstream AgentFS Go SDK as a persistentgbashfilesystem backendagentfsfsadapter implementinggbash/fs.FileSystem, including symlink, hard link, recursive remove, cwd, and FIFO supportWhy
There was no example showing how to persist
gbashstate on top of an external agent-oriented filesystem SDK. This change demonstrates the integration path without changing the publicgbashAPI surface.Impact
Embedders now have a concrete reference for wiring
gbash.CustomFileSystem(...)to AgentFS while keeping one-shot execution, stdin execution, and REPL behavior aligned with the existing persistent filesystem examples.Validation
go test ./examples/internal/agentfsfs ./examples/agentfs-backed-fsmake lint