Skip to content

WIP#435

Draft
alishakawaguchi wants to merge 5 commits intomainfrom
alisha/factoryai-agent
Draft

WIP#435
alishakawaguchi wants to merge 5 commits intomainfrom
alisha/factoryai-agent

Conversation

@alishakawaguchi
Copy link

No description provided.

alishakawaguchi and others added 5 commits February 19, 2026 10:02
Implement the agent.Agent interface for Factory AI Droid, including
session lifecycle management, hook handling, and JSONL transcript
parsing. Register the new agent in the agent registry and wire it
into config detection, hooks, and summarization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 7fc7ad5b176b
The Droid transcript parser was using the shared Claude Code parser which
expects {"type":"assistant",...} but Droid uses {"type":"message","message":
{"role":"assistant",...}}. This caused ExtractModifiedFiles to skip all lines,
preventing checkpoint creation entirely.

- Add Droid-specific JSONL parser (ParseDroidTranscript) that normalizes the
  envelope format by extracting message.role as Line.Type
- Wire Droid parser into all transcript analysis functions (lifecycle.go,
  transcript.go) replacing shared transcript.ParseFromFileAtLine calls
- Remove TranscriptPreparer/sentinel flush code (Droid never writes hook
  commands to JSONL, causing a 3s timeout on every turn-end)
- Add idempotent session-end handling for agents that fire SessionEnd twice
- Initialize session Phase to PhaseIdle in both strategies (was zero-value "")
- Update all test fixtures to use Droid JSONL format and add parser tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: fe59ba01b450
- Replace IIFE pattern in ExtractSummary with idiomatic sequential error handling
- Remove single-use type aliases (assistantMessage, toolInput) in favor of
  direct transcript.AssistantMessage/transcript.ToolInput references
- Simplify ExtractAllModifiedFilesFromTranscript dedup since ExtractModifiedFiles
  already returns deduplicated results
- Consolidate makeWriteToolLine/makeEditToolLine into shared makeFileToolLine helper

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 979a49177542
Cover agent detection, hook installation, session stubs, enable command
smoke tests, and strategy composition for the factoryai-droid agent.
Unit tests for the agent package are also included.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 1a75b7499be8
Copilot AI review requested due to automatic review settings February 19, 2026 23:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds first-class support for the Factory AI Droid agent to Entire CLI, wiring it into agent registration, hook installation/handling, transcript parsing/analysis, and integration tests, while also improving session lifecycle robustness.

Changes:

  • Register the factoryai-droid agent (new agent type/name constants + agent package + CLI registration imports).
  • Add Factory Droid hook installation/uninstallation and transcript parsing/analyzers (including subagent-aware file/token extraction) with extensive tests.
  • Improve session lifecycle handling (initialize session Phase, and make SessionEnd handling idempotent).

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/entire/cli/summarize/summarize.go Treats Factory Droid as a supported agent type for condensed transcript generation (currently routed through Claude parsing).
cmd/entire/cli/strategy/manual_commit_session.go Initializes new session state with an explicit Phase value.
cmd/entire/cli/strategy/auto_commit.go Initializes new session state with an explicit Phase value.
cmd/entire/cli/lifecycle.go Makes SessionEnd handling idempotent by skipping duplicate end events for already-ended sessions.
cmd/entire/cli/integration_test/setup_factoryai_hooks_test.go Adds integration smoke tests verifying hook installation and preservation of existing Factory settings.
cmd/entire/cli/integration_test/hooks.go Adds a Factory Droid hook runner and helpers for simulating hook flows in integration tests.
cmd/entire/cli/integration_test/agent_test.go Adds integration tests for Factory Droid agent detection, hook installation, and helper/stub behaviors.
cmd/entire/cli/integration_test/agent_strategy_test.go Adds end-to-end strategy composition tests for Factory Droid hooks → lifecycle → strategy checkpointing.
cmd/entire/cli/hooks_cmd.go Ensures the Factory Droid agent package is imported so it’s registered for hook subcommands.
cmd/entire/cli/config.go Ensures the Factory Droid agent package is imported so it’s registered for config/setup flows.
cmd/entire/cli/agent/registry.go Adds AgentNameFactoryAIDroid and AgentTypeFactoryAIDroid constants.
cmd/entire/cli/agent/factoryaidroid/types.go Introduces Factory settings schema types and transcript/tool constants used by the new agent.
cmd/entire/cli/agent/factoryaidroid/transcript.go Implements Droid transcript parsing/normalization plus modified-file and token/subagent extraction logic.
cmd/entire/cli/agent/factoryaidroid/transcript_test.go Adds unit tests for parsing, token usage calculations, and subagent-aware file extraction.
cmd/entire/cli/agent/factoryaidroid/lifecycle.go Implements lifecycle hook parsing and transcript analyzer/token calculator interfaces for Factory Droid.
cmd/entire/cli/agent/factoryaidroid/lifecycle_test.go Adds unit tests for lifecycle event parsing from hook payloads.
cmd/entire/cli/agent/factoryaidroid/hooks.go Implements Factory hook install/uninstall/idempotency plus permissions deny-rule enforcement.
cmd/entire/cli/agent/factoryaidroid/hooks_test.go Adds unit tests covering hook installation/uninstallation, idempotency, and preservation of user config.
cmd/entire/cli/agent/factoryaidroid/factoryaidroid.go Implements the core agent.Agent integration and self-registration for Factory Droid.
cmd/entire/cli/agent/factoryaidroid/factoryaidroid_test.go Adds unit tests for the Factory Droid agent’s basic behaviors and stubs.
CLAUDE.md Updates docs to mention the factoryai-droid stub option for E2E_AGENT.

Comment on lines 116 to 120
switch agentType {
case agent.AgentTypeGemini:
return buildCondensedTranscriptFromGemini(content)
case agent.AgentTypeClaudeCode, agent.AgentTypeUnknown:
case agent.AgentTypeClaudeCode, agent.AgentTypeFactoryAIDroid, agent.AgentTypeUnknown:
// Claude format - fall through to shared logic below
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

AgentTypeFactoryAIDroid is currently handled by the Claude JSONL parser (transcript.ParseFromBytes), but Factory Droid transcripts use a different envelope (outer type:"message" with inner message.role). This will produce lines with Type=="message" and prevent condensed transcript extraction. Add a Factory Droid-specific branch here that parses with the factoryaidroid transcript normalizer (so the resulting transcript.Line entries have Type = user/assistant) before calling BuildCondensedTranscript.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to 120
case agent.AgentTypeClaudeCode, agent.AgentTypeFactoryAIDroid, agent.AgentTypeUnknown:
// Claude format - fall through to shared logic below
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

BuildCondensedTranscriptFromBytes now has a Factory Droid-specific code path via AgentTypeFactoryAIDroid, but there is no unit test covering Droid-envelope JSONL input. Add a test that feeds a minimal Factory Droid transcript (outer type:"message" with message.role) and asserts the condensed output contains the expected user/assistant entries.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments