44 Commits

Author SHA1 Message Date
머니페니
8ff41cc687 docs: add Phase 4 environment variables to .env.example 2026-03-20 22:37:14 +09:00
머니페니
c957b208e2 feat: add build-sandbox.sh for sandbox image building 2026-03-20 22:36:02 +09:00
머니페니
ace1858452 feat: add deploy.sh for Oracle VM deployment automation 2026-03-20 22:34:32 +09:00
머니페니
ec713213cc chore: add .worktrees to .gitignore 2026-03-20 22:32:35 +09:00
머니페니
f63499a1c3 docs: update HANDOFF for Phase 4 completion 2026-03-20 18:47:38 +09:00
머니페니
b2c52abf06 feat: integrate Recovery, CostGuard, ContainerCleaner in lifespan
- webapp.py lifespan now initializes json_logging, recovery, cost_guard, task_history
- Dispatcher receives cost_guard and task_history dependencies
- ContainerCleaner starts if Docker is available
- Added /health/costs endpoint for API cost monitoring
- Added tests/test_smoke.py with 2 tests for basic health and costs endpoint
- All existing health tests still pass (8 tests)
2026-03-20 18:46:24 +09:00
머니페니
c0cb4b7499 feat: integrate CostGuard and TaskHistory into Dispatcher
- Add cost_guard and task_history optional parameters to Dispatcher.__init__
- Check daily cost limit before dequeuing tasks
- Record usage with CostGuard after successful task completion
- Record task history (success and failure) with TaskHistory
- Maintain backward compatibility (cost_guard=None, task_history=None)
- Add tests for cost recording and daily limit blocking
2026-03-20 18:44:22 +09:00
머니페니
e82dfe18f9 feat: add startup recovery and periodic container cleanup
- Add reset_running_to_pending() to PersistentTaskQueue for recovery
- Implement recover_on_startup() to reset interrupted tasks and clean zombies
- Add ContainerCleaner for periodic removal of old sandbox containers
- Add 4 tests covering recovery scenarios and container cleanup logic
2026-03-20 18:41:41 +09:00
머니페니
3f0d021b02 feat: add structured JSON logging with configurable format 2026-03-20 18:41:00 +09:00
머니페니
edeb336cb8 feat: add CostGuard for API cost tracking and limiting 2026-03-20 18:40:53 +09:00
머니페니
0c4c22be5a feat: add AutoMerge with E2E-conditional merge logic 2026-03-20 18:40:52 +09:00
머니페니
db6e9b4a41 feat: add TaskHistory for completed task audit logging
Implements SQLite-based task history tracking with metrics (cost, duration, tokens).
- TaskHistory class with record() and get_recent() methods
- Tracks task_id, thread_id, issue_number, repo_name, source, status
- Records duration_seconds, tokens_input, tokens_output, cost_usd, error_message
- 4 passing tests covering completed/failed recording, ordering, empty state
2026-03-20 18:40:47 +09:00
머니페니
140fbd17ff docs: update HANDOFF for Phase 3 completion 2026-03-20 18:26:40 +09:00
머니페니
a58bbca9b7 test: add webhook-to-dispatcher integration test 2026-03-20 18:25:33 +09:00
머니페니
d35efae12e feat: add health check endpoints for Gitea, Discord, and queue
Adds three new monitoring endpoints:
- GET /health/gitea — Verifies Gitea API connectivity
- GET /health/discord — Reports Discord bot connection status
- GET /health/queue — Returns pending task count

All endpoints return JSON with status field. The Gitea endpoint
includes the API status code on success or error message on failure.
Discord endpoint returns "not_configured", "connecting", or "ok" with
bot username. Queue endpoint includes pending_tasks count.

Tests use mock lifespan to avoid initializing task queue, message
store, dispatcher, and discord handler during testing.
2026-03-20 18:24:07 +09:00
머니페니
7e95aeb8ce feat: integrate Discord bot and Dispatcher in FastAPI lifespan
Adds asynccontextmanager lifespan to webapp.py that:
- Initializes task_queue and message_store on startup
- Starts Dispatcher as background task
- Starts Discord bot gateway if DISCORD_TOKEN is set
- Properly shuts down all resources on application exit

This completes Phase 3 Task 6, enabling the webapp to run Discord bot
and dispatcher concurrently with the webhook server.
2026-03-20 18:21:59 +09:00
머니페니
da9caca791 feat: add Dispatcher for background task processing 2026-03-20 18:20:29 +09:00
머니페니
5a471907fa feat: add Discord Bot Gateway handler with mention parsing
Implements discord.py Bot Gateway to receive @agent mentions and enqueue tasks.
Includes deterministic thread ID generation and message parsing for issue numbers,
repo names, and freeform requests. Supports message queuing for running threads.

Files:
- agent/integrations/discord_handler.py: DiscordHandler class with event handling
- tests/test_discord_handler.py: 4 tests for parsing and thread ID generation

All tests pass (95 total).
2026-03-20 18:18:43 +09:00
머니페니
8c274b4be2 feat: complete Gitea webhook event parsing and task dispatch
- Add parse_gitea_event() function to parse issue comments, labels, and PR review requests
- Detect @agent mentions in issue comments and strip them from message
- Implement rate limiting with slowapi (10 requests/minute)
- Integrate with PersistentTaskQueue and MessageStore
- Queue messages if task is already running for the same thread
- Add 6 comprehensive tests for event parsing and signature verification
2026-03-20 18:15:07 +09:00
머니페니
9242badeff feat: add MessageStore and update check_message_queue middleware
- Implement SQLite-based MessageStore for follow-up messages
- Replace LangGraph store with MessageStore in check_message_queue middleware
- Preserve all multimodal content parsing logic
- Add comprehensive tests for MessageStore (4 tests, all passing)
- All 85 tests pass
2026-03-20 18:11:15 +09:00
머니페니
0136823462 feat: add PersistentTaskQueue with SQLite backend
Implements Task 1 of Phase 3: SQLite-based persistent task queue with:
- FIFO ordering (created_at ASC)
- Concurrency limit (default 1 running task)
- State machine: pending → running → completed|failed|timeout
- Methods: enqueue, dequeue, mark_completed, mark_failed, get_pending, has_running_task
- Thread-aware task tracking
- Singleton pattern with lazy initialization

All 8 tests passing.
2026-03-20 18:04:57 +09:00
머니페니
60aeebf7a7 docs: update HANDOFF for Phase 2 completion
Phase 2 complete: 73 tests passing, 9/9 tasks done.
All core features implemented: DockerSandbox, GiteaClient,
gitea_comment, discord_reply, commit_and_open_pr, prompt loading,
path validator, LangGraph ARM64 verified.
2026-03-20 17:48:03 +09:00
머니페니
94edb45c86 chore: add langgraph-server to docker-compose (ARM64 verified)
langchain/langgraph-api:3.11 pulls and runs on ARM64.
Uses SQLite for local state management.
2026-03-20 17:46:29 +09:00
머니페니
816415dd24 feat: complete PR creation via GiteaClient in commit_and_open_pr and open_pr 2026-03-20 17:44:45 +09:00
머니페니
af7bd2cdc3 feat: add prompt loading pipeline and path validator
- Add read_repo_instructions() to read both AGENTS.md and CLAUDE.md
- Add path_validator.validate_paths() for writable/blocked path enforcement
- Add 10 passing tests (test_prompt_loading.py, test_path_validator.py)
- All 71 tests pass
2026-03-20 17:42:34 +09:00
머니페니
e8983d8534 feat: implement gitea_comment and discord_reply tools 2026-03-20 17:39:45 +09:00
머니페니
b2ad726fc4 feat: implement GiteaClient with Gitea REST API v1
Implemented full async Gitea REST API v1 client using httpx with the following methods:
- create_pull_request: Create PRs with title, head, base, and body
- merge_pull_request: Merge PRs with configurable merge type
- create_issue_comment: Post comments on issues/PRs
- get_issue: Fetch issue/PR details
- get_issue_comments: Retrieve all comments for an issue/PR
- create_branch: Create new branches from existing ones

Added lazy singleton pattern with get_gitea_client() factory function that reads GITEA_URL and GITEA_TOKEN from environment.

All methods properly call raise_for_status() and return JSON responses. Comprehensive test suite with 8 tests covering all methods plus error handling.
2026-03-20 16:11:52 +09:00
머니페니
5d44c2e7e2 feat: implement DockerSandbox with docker-py container management
Implement DockerSandbox extending deepagents' BaseSandbox to manage Docker
containers via docker-py. This completes Task 1 of Phase 2.

Key implementation details:
- Extends BaseSandbox which auto-implements file I/O (read/write/ls/grep)
  by delegating to execute()
- Synchronous execute() method called via loop.run_in_executor() by server.py
- Container lifecycle management (create/connect/close)
- Upload/download file support via tar archives
- Configurable resource limits (memory, CPU, PIDs)
- Timeout support with proper exit code handling
- Environment variable configuration via create_sandbox() factory

Tests:
- 6 new tests covering container creation, command execution, and cleanup
- All 46 tests passing (40 existing + 6 new)
2026-03-20 16:07:27 +09:00
머니페니
bb2a47157e fix: replace original Dockerfile with agent server Dockerfile 2026-03-20 15:30:14 +09:00
머니페니
8e60da4f3c test: fix remaining tests after code cleanup
All 40 tests pass without any code changes needed:
- test_config.py (4 tests)
- test_ensure_no_empty_msg.py (21 tests)
- test_multimodal.py (11 tests)
- test_sandbox_paths.py (4 tests)

No broken imports from deleted modules found.
2026-03-20 15:19:55 +09:00
머니페니
355275bef1 feat: add docker-compose with socket proxy and agent server 2026-03-20 15:19:19 +09:00
머니페니
8d30e13f46 feat: add Dockerfiles for agent server and sandbox (ARM64) 2026-03-20 15:18:18 +09:00
머니페니
760adf3632 refactor: update open_pr middleware for Gitea 2026-03-20 15:12:11 +09:00
머니페니
4f2cb5bd1e refactor: replace GitHub with Gitea in commit_and_open_pr 2026-03-20 15:11:36 +09:00
머니페니
046ce14888 refactor: update system prompt for Gitea/Discord 2026-03-20 15:07:46 +09:00
머니페니
969929632e refactor: replace GitHub/Linear/Slack webhooks with Gitea stub 2026-03-20 15:05:04 +09:00
머니페니
64e54a7392 refactor: replace GitHub/Linear/Slack with Gitea/Discord in server.py 2026-03-20 15:04:48 +09:00
머니페니
4382499071 refactor: clean up imports and references after code removal 2026-03-20 14:58:50 +09:00
머니페니
e16c6eeb70 feat: add stub modules for Phase 2 (Docker, Gitea, Discord) 2026-03-20 14:55:41 +09:00
머니페니
a9e0115824 feat: add config module with pydantic-settings 2026-03-20 14:55:02 +09:00
머니페니
2a2e98c53d chore: update dependencies for galaxis-agent 2026-03-20 14:48:59 +09:00
머니페니
0e5672f648 refactor: extract git utilities from github.py into git_utils.py 2026-03-20 14:47:05 +09:00
머니페니
33db8eb7b0 chore: remove Linear, Slack, GitHub, and cloud sandbox code 2026-03-20 14:41:20 +09:00
머니페니
b79a6c2549 chore: initial copy from open-swe 2026-03-20 14:38:07 +09:00