Skip to content

feat(agents): add autohand adapter#139

Closed
yyovil wants to merge 1 commit into
agents/19-pifrom
agents/20-autohand
Closed

feat(agents): add autohand adapter#139
yyovil wants to merge 1 commit into
agents/19-pifrom
agents/20-autohand

Conversation

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

Adds the autohand agent adapter, registering it in the activity-dispatch map and the adapter registry. The adapter follows the same structural pattern as existing adapters (claudecode, cline, etc.) and includes launch/restore command building, session info extraction, and hook lifecycle management.

  • New package autohand provides Plugin implementing both adapters.Adapter and ports.Agent, with binary resolution, permission-mode flag mapping, and atomic config rewrites for hook install/uninstall.
  • Custom UnmarshalJSON/MarshalJSON on autohandHookEntry preserves unknown user-set fields (e.g. async, filter) via an Extra map[string]json.RawMessage, addressing the field-dropping concern raised in the previous review.
  • autohandBinary now gates on ctx.Err() before acquiring the mutex, ensuring a cancelled context is honoured even when the binary path is already cached — closing the second gap from the prior review.

Confidence Score: 5/5

Safe to merge; both issues surfaced in the prior review have been resolved and no new correctness problems were found.

Both previously flagged issues are fixed: unknown hook-entry fields now survive config rewrites through the custom UnmarshalJSON/MarshalJSON round-trip, and context cancellation is honoured in the cached-binary fast path of autohandBinary. The rest of the adapter — binary resolution, permission-mode mapping, atomic config writes, and the activity-state deriver — is implemented consistently with the existing adapter patterns and is well covered by the new test suite.

No files require special attention.

Important Files Changed

Filename Overview
backend/internal/adapters/agent/autohand/hooks.go Hook install/uninstall/query logic with atomic config writes; custom MarshalJSON/UnmarshalJSON correctly round-trips unknown user fields via Extra map.
backend/internal/adapters/agent/autohand/autohand.go Main adapter implementing launch/restore command building, binary resolution with mutex-protected caching, and session info surfacing; context cancellation is correctly checked on all code paths including the cached-binary fast path.
backend/internal/adapters/agent/autohand/autohand_test.go Comprehensive test suite covering argv building, permission-mode mapping, hook install/uninstall idempotency, unknown-field round-trip, and context cancellation across all methods including GetLaunchCommand with a cached binary.
backend/internal/adapters/agent/autohand/activity.go Simple event-to-ActivityState mapper; covers all four installed hook subcommands and returns (empty, false) for unknowns.
backend/internal/adapters/agent/activitydispatch/dispatch.go One-line addition registering autohand.DeriveActivityState in the Derivers map; no issues.
backend/internal/adapters/agent/registry/registry.go Adds autohand.New() to Constructors(); straightforward registration matching the existing pattern.
backend/internal/daemon/wiring_test.go Extends the resolver integration test with the HarnessAutohand → autohand mapping; no issues.

Reviews (2): Last reviewed commit: "feat(agents): add autohand adapter" | Re-trigger Greptile

Comment thread backend/internal/adapters/agent/autohand/hooks.go
Comment thread backend/internal/adapters/agent/autohand/autohand.go
Registers the autohand harness, stacked on the agent platform. Includes its own activity deriver.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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