Skip to content

feat(agents): add crush adapter#124

Closed
yyovil wants to merge 1 commit into
agents/04-agyfrom
agents/05-crush
Closed

feat(agents): add crush adapter#124
yyovil wants to merge 1 commit into
agents/04-agyfrom
agents/05-crush

Conversation

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

Adds a new Crush agent adapter following the same structure as the existing codex and agy adapters: launch/restore commands, a no-op hooks layer (pending native Crush hook support), and registration in the adapter registry and wiring test.

  • crush.go correctly omits --session on launch so Crush can mint its own native session ID, and gates GetRestoreCommand on MetadataKeyAgentSessionID being populated — consistent with how other no-hook adapters are expected to evolve.
  • hooks.go stubs all three hook methods as no-ops with context guards, and activity.go provides the same stub pattern for DeriveActivityState, though that function is not yet wired into activitydispatch/dispatch.go unlike every other adapter's equivalent.

Confidence Score: 5/5

Safe to merge; the adapter is correctly scoped as a launch-only stub with no hooks, and the restore path is properly gated.

All changed code is new and self-contained. The launch/restore/manifest logic is straightforward and well-tested. Hooks and activity state are intentional no-ops with clear TODO markers for future work. The one gap — crush.DeriveActivityState not yet registered in the dispatch table — has no runtime consequence until hook support is added.

activitydispatch/dispatch.go will need a "crush" entry added before Crush hook support ships.

Important Files Changed

Filename Overview
backend/internal/adapters/agent/crush/crush.go Core crush adapter: launch/restore/sessionInfo all correct; restore correctly gates on MetadataKeyAgentSessionID; binary resolver mirrors codex/agy patterns faithfully.
backend/internal/adapters/agent/crush/hooks.go All three hook methods are correctly stubbed as no-ops with ctx.Err guards; consistent with the documented pending hook support.
backend/internal/adapters/agent/crush/activity.go No-op DeriveActivityState correctly returns ("", false); defined for future use but not yet wired into activitydispatch/dispatch.go.
backend/internal/adapters/agent/crush/crush_test.go Thorough test coverage for launch/restore/sessionInfo/manifest/hooks; restore tests correctly verify the MetadataKeyAgentSessionID gating behaviour.
backend/internal/adapters/agent/crush/activity_test.go Minimal test verifying no-op behaviour of DeriveActivityState; appropriate scope for the current implementation.
backend/internal/adapters/agent/registry/registry.go crush.New() correctly added to the Constructors slice alongside the other adapters.
backend/internal/daemon/wiring_test.go HarnessCrush/"crush" resolver test case added correctly; verifies end-to-end wiring.

Sequence Diagram

sequenceDiagram
    participant AO as AO Session Manager
    participant Registry as adapter/registry
    participant Crush as crush.Plugin
    participant Binary as crush binary

    AO->>Registry: Constructors()
    Registry-->>AO: [..., crush.New()]

    AO->>Crush: GetLaunchCommand(LaunchConfig)
    Crush->>Crush: crushBinary() — resolve + cache path
    Crush-->>AO: [crush, --cwd, path, (--yolo), --, prompt]

    AO->>Binary: exec(cmd)
    Note over Binary: Crush mints its own native session ID (no --session on launch)

    AO->>Crush: GetRestoreCommand(RestoreConfig)
    Note over Crush: Reads MetadataKeyAgentSessionID from session metadata
    alt agentSessionID present
        Crush-->>AO: "[crush, --cwd, path, --session, id], ok=true"
    else agentSessionID absent
        Crush-->>AO: "nil, ok=false"
    end

    AO->>Crush: GetAgentHooks / AreHooksInstalled
    Note over Crush: No-op — hooks not yet supported
    Crush-->>AO: (nil / false)
Loading

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

Comment thread backend/internal/adapters/agent/crush/crush.go Outdated
Registers the crush harness, stacked on the agent platform.

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