feat(agents): add DroidAgentWatcher for Factory Droid sessions#31
Open
panosAthDBX wants to merge 1 commit intoAtaraxy-Labs:mainfrom
Open
feat(agents): add DroidAgentWatcher for Factory Droid sessions#31panosAthDBX wants to merge 1 commit intoAtaraxy-Labs:mainfrom
panosAthDBX wants to merge 1 commit intoAtaraxy-Labs:mainfrom
Conversation
There was a problem hiding this comment.
inspect review
Triage: 45 entities analyzed | 0 critical, 0 high, 3 medium, 42 low
Verdict: standard_review
Findings (4)
- [low] Mixed time bases in seed vs runtime heuristics: in seed mode
toolUseSeenAtandlastGrowthAtare set tomtimeMs(filesystem timestamp), but unchanged-file heuristics compare againstDate.now()(wall clock). This can cause immediate or delayedwaiting/staletransitions depending on file age/clock skew. Evidence: seed settoolUseSeenAt: ... ? mtimeMs : undefinedandlastGrowthAt: ... ? mtimeMs : undefined; unchanged path usesconst now = Date.now(); now - prev.toolUseSeenAtandnow - prev.lastGrowthAt. - [low] Runtime incompatibility: watcher uses Bun-specific APIs (
Bun.file(...)) insidepackages/runtime/src/agents/watchers/droid.ts. If runtime is executed under Node (common for server runtimes), this will throw becauseBunis undefined. Evidence:text = await Bun.file(filePath).text();andconst buf = await Bun.file(filePath).arrayBuffer();. - [low] Incremental read is not actually incremental and can be a production perf bug: despite the comment 'only new bytes', it reads the entire file into memory every time via
Bun.file(filePath).arrayBuffer()and then slices. Large/long-running JSONL sessions will cause repeated full-file reads. Evidence:// --- Incremental read: only new bytes ---followed byconst buf = await Bun.file(filePath).arrayBuffer();. - [low] Potential unhandled promise rejection from
fs.watchcallbacks:processFileisasyncand is invoked withoutawait/.catch()insidewatch(...)handlers. IfprocessFileever throws (e.g., unexpected runtime error), it can surface as an unhandled rejection. Evidence:watch(dirPath, (...) => { ... this.processFile(...); })and similarly for the sessionsDir watcher.
Reviewed by inspect | Entity-level triage found 0 high-risk changes
Contributor
|
I've used droid in the past, awesome harness! will test this out on my end and leave feedback if needed, thanks for the PR 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new agent watcher for Factory Droid sessions, following the existing pattern used by Claude Code, Codex, Amp, OpenCode, and Pi.
~/.factory/sessions/<encoded-path>/<session-id>.jsonlfor appended eventssession_start,message,todo_state,session_end)running/waiting/done/stalestatuses using the same semantics other watchers use/Users/foo/proj→-Users-foo-proj)tool_use+ file stops growing past threshold →waiting)stale)Changes
packages/runtime/src/agents/watchers/droid.ts(DroidAgentWatcher, 461 lines)packages/runtime/test/droid-watcher.test.ts(15 tests, all pass)DroidAgentWatcherfrompackages/runtime/src/index.tsapps/server/src/main.tsalongside other built-in watchersdroid: ["droid", "factory"]to the agent pattern map inpackages/runtime/src/server/index.tsTest plan
bun test packages/runtime/test/droid-watcher.test.ts— 15/15 passbun test packages/runtime/test— 382/382 pass (no regressions)Happy to iterate on style, docstring placement, or the status-mapping thresholds if they should match constants elsewhere in the codebase.