Skip to content

examples: add AgentFS-backed filesystem demo - #755

Merged
ewhauser merged 3 commits into
mainfrom
ewhauser/agentfs-backed-fs-example
Mar 28, 2026
Merged

ewhauser merged 3 commits into
mainfrom
ewhauser/agentfs-backed-fs-example

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • add an agentfs-backed-fs example that uses the upstream AgentFS Go SDK as a persistent gbash filesystem backend
  • add an internal agentfsfs adapter implementing gbash/fs.FileSystem, including symlink, hard link, recursive remove, cwd, and FIFO support
  • document the new example in the repo README and website example guides

Why

There was no example showing how to persist gbash state on top of an external agent-oriented filesystem SDK. This change demonstrates the integration path without changing the public gbash API 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-fs
  • make lint

@ewhauser ewhauser changed the title [codex] examples: add AgentFS-backed filesystem demo examples: add AgentFS-backed filesystem demo Mar 28, 2026
@ewhauser
ewhauser marked this pull request as ready for review March 28, 2026 13:40
@ewhauser
ewhauser merged commit 042cc82 into main Mar 28, 2026
15 checks passed
@ewhauser
ewhauser deleted the ewhauser/agentfs-backed-fs-example branch March 28, 2026 13:40

@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: 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))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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