Skip to content

Add Pi AgentVFS checkpoint rewind integration#8

Merged
Zhihaoi merged 3 commits into
thustorage:mainfrom
xwhu:main
Jun 7, 2026
Merged

Add Pi AgentVFS checkpoint rewind integration#8
Zhihaoi merged 3 commits into
thustorage:mainfrom
xwhu:main

Conversation

@xwhu
Copy link
Copy Markdown

@xwhu xwhu commented Jun 6, 2026

Summary

This PR adds a Pi coding-agent extension that integrates ContextFS AgentVFS checkpoints with Pi session
flow, conversation tree navigation, and manual rewind commands.

It also hardens the AgentVFS daemon startup path so background daemon mode keeps control/telemetry/
filesystem services alive, and improves checkpoint/object-store failure diagnostics used by the
extension.

Changes

  • Fix AgentVFS daemon startup to fork before service threads are created, then keep libfuse in
    foreground mode inside the daemonized child.
  • Improve control socket error reporting and cleanup on socket/bind/listen failures.
  • Add object-store write error tracking, checkpoint serialization error propagation, and writable shard
    validation during store initialization.
  • Add a Pi extension under extensions/pi that:
    • discovers the AgentVFS mount and control socket
    • creates session-start, pre-tool, user-bash, and turn-end checkpoints
    • persists checkpoint metadata per workspace/session
    • provides /agentvfs and /rewind commands
    • restores workspace state before Pi fork and /tree navigation
    • maintains an undo stack for rewind operations
    • shows checkpoint status in the Pi footer
  • Add documentation for installing and using the Pi AgentVFS rewind extension, plus design notes
    comparing AgentVFS rewind with Git-based rewind.

Testing

  • Added coverage for daemonized control socket availability.
  • Added coverage for rejecting unwritable object shard directories.
  • Updated checkpoint behavior coverage for skipped ZERO_HASH leaves.

Shinwell Hu added 3 commits June 6, 2026 20:21
Fork the daemon before creating control, telemetry, and filesystem service threads, then keep libfuse in foreground mode so those threads remain alive after daemon startup.

Harden startup and checkpoint failure handling around that flow:

- report control-socket socket/bind/listen failures and clean up failed descriptors
- validate existing object shard directories are writable during init_layout
- track ObjectStore write errors and surface them through checkpoint serialization
- skip ZERO_HASH leaves during bootstrap and tree serialization instead of failing the checkpoint
- cover daemonized control-socket status and unwritable shard cases in tests
Introduce a Pi extension that binds Pi session events to a running ContextFS agentvfs daemon through agentvfs-ctl.

The extension discovers the agentvfs FUSE mount for Pi's cwd, resolves the control socket from AGENTVFS_SOCK or /tmp, and disables itself when Pi is not running inside the mount.

It records session-start, pre-tool, user bash, and turn-end checkpoints for mutating write/edit/bash activity, stores checkpoint entries in the Pi conversation stream when supported, and persists per-workspace checkpoint metadata under the user state directory for resumed sessions.

It also adds the user-facing rollback surface:

- /agentvfs status, checkpoint, rewind, tree on/off, and mount
- /rewind compatibility flow with an undo stack backed by before-restore checkpoints
- fork and /tree hooks that restore the workspace to the matching checkpoint before Pi switches conversation branches
- footer status showing AgentVFS checkpoint availability

Ship the package manifest and README documenting installation, runtime requirements, direct agentvfs-ctl usage, and the extension file layout.
@Zhihaoi Zhihaoi merged commit 84f6d53 into thustorage:main Jun 7, 2026
5 checks passed
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.

2 participants