Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.23"
go-version: "1.25.x"

- name: Install build deps (CGO sqlite)
run: sudo apt-get update && sudo apt-get install -y gcc libc6-dev
Expand All @@ -24,8 +24,16 @@ jobs:
- name: Vet
run: make vet

- name: Test
run: make test
- name: Lint
run: make lint

- name: Test + coverage gate
run: make coverage-gate COVERAGE_MIN=20

- name: Build
run: make build

- name: govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
19 changes: 12 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,19 @@ Configured via `llm.provider` in config. Supported values: `ollama` (default, no

### Memory
- `pkg/memory/manager.go`: appends facts learned during execution to a per-goal store.
- `pkg/memory/semantic.go`: vector-based retrieval providing relevant past facts to the planner as context, improving replanning quality.
- `pkg/memory/semantic.go`: TF-IDF semantic retrieval of past facts for planner context (not a vector DB).

### Configuration that affects behavior
- Primary config: `~/.config/octaai/config.yaml` (created by `octa-agent init`).
- Key sections in `pkg/config/config.go`:
- `llm`: provider / model / base_url / api_key / temperature / max_tokens
- `safety`: allow_paths, allow_http_hosts, deny_commands, require_confirmation_for
- `engine`: max_loops, max_retries, enable_replan, enable_parallel
- `isolation`: enabled, docker (image/network/memory/cpu limits), require_docker_for
- `browser`: enabled, port, token, browser_domains
- `storage`: type, path (defaults to `~/.config/octaai/state.db`)
- `llm`: provider / model / base_url / api_key / temperature / max_tokens
- `safety`: allow_paths, allow_http_hosts, deny_commands, require_confirmation_for
- `engine`: max_loops, max_retries, enable_replan, enable_parallel
- `isolation`: enabled, docker (image/network/memory/cpu limits), require_docker_for
- `browser`: enabled, port, token, browser_domains
- `storage`: type, path (defaults to `~/.config/octaai/state.db`)
- `features`: `use_htn_planner` / `use_dag_executor` / `use_capabilities` are wired; AG2/MCP/vector/reflection flags remain unimplemented.
- Daemon health: `--health-addr` (default `127.0.0.1:8766`) serves `/healthz` and `/readyz`.

### Memory note
- `pkg/memory/semantic.go` is TF-IDF keyword retrieval, not a vector database. `features.use_vector_memory` is unimplemented.
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM golang:1.23-bookworm AS builder
FROM golang:1.25-bookworm AS builder

RUN apt-get update && apt-get install -y gcc libc6-dev && rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends gcc libc6-dev \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /src
COPY go.mod go.sum ./
Expand All @@ -12,7 +14,9 @@ RUN make build

FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y ca-certificates git openssh-client && rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git openssh-client \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /src/bin/octa-agentd /usr/local/bin/octa-agentd
COPY --from=builder /src/bin/octa-agent /usr/local/bin/octa-agent
Expand All @@ -24,4 +28,7 @@ WORKDIR /home/octa
ENV HOME=/home/octa
VOLUME ["/home/octa/.config/octaai"]

# Daemon health (optional): map host port to container 8766
EXPOSE 8766

ENTRYPOINT ["octa-agentd"]
36 changes: 36 additions & 0 deletions IMPLEMENTATION_LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# OctaAI Implementation Log

## Session 2026-07-19 — Remaining plan items completed

Completed all open items from `IMPLEMENTATION_PLAN.md` without deferral.

### Phase 5.4 — Coverage
- Added engine helpers/runner/feature-flag tests
- Added tools registry/filesystem/git coverage
- Totals: ~34% overall, engine ~19%, tools ~26%

### Phase 6 — Operability
- `make lint` (golangci-lint or vet/gofmt fallback)
- `make coverage-gate` (default `COVERAGE_MIN=20`)
- CI runs lint + coverage-gate + govulncheck
- Docker usage documented (local-first, no K8s)
- Daemon health: `--health-addr` → `/healthz`, `/readyz` (`pkg/health`)

### Phase 7 — Architecture wiring
- `features.use_htn_planner` → `HTNBridge` (HTN + v1 fallback)
- `features.use_dag_executor` → `pkg/executor.Scheduler`
- `features.use_capabilities` → builtin capability registry on engine
- AG2 / MCP / vector / adaptive-replan / reflection remain unimplemented and documented as such

### Verification
- `make test` green
- `make coverage-gate COVERAGE_MIN=15` (CI uses 20)
- `make build` green

### How to enable v2 (optional)
```yaml
features:
use_htn_planner: true
use_dag_executor: true
use_capabilities: true
```
85 changes: 85 additions & 0 deletions IMPLEMENTATION_PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# OctaAI Implementation Plan

Machine-readable roadmap derived from the full repository audit (2026-07-18).
Updated 2026-07-19 — remaining phases completed.

---

## Phase 1 — Critical Security & Broken CI

### [x] Task 1.1 — Fix Docker isolation shell injection
### [x] Task 1.2 — Close filesystem path escape (symlink + prefix)
### [x] Task 1.3 — Upgrade vulnerable dependencies
### [x] Task 1.4 — Restore green CI (`make test`)
### [x] Task 1.5 — Harden config secret handling

---

## Phase 2 — Browser Automation Correctness

### [x] Task 2.1 — Align WebSocket URL path (server ↔ extension)
### [x] Task 2.2 — Align default port (8765 vs 9090)
### [x] Task 2.3 — Add missing extension icons / fix load blockers
### [x] Task 2.4 — Fix documentation contradictions for browser security
### [x] Task 2.5 — Move WS token out of query string

---

## Phase 3 — Feature-Flag Honesty & Incomplete Surface Cleanup

### [x] Task 3.1 — Document/disable unwired feature flags
### [x] Task 3.2 — Correct stale product documentation
### [x] Task 3.3 — Implement HTN planner `Replan`

---

## Phase 4 — Defense-in-Depth & Safety Hardening

### [x] Task 4.1 — SSRF defense-in-depth in HTTP tool
### [x] Task 4.2 — Reject empty `allow_paths` in production defaults
### [x] Task 4.3 — Restrict WebSocket empty Origin policy
### [x] Task 4.4 — SQLite concurrency hardening

---

## Phase 5 — Testing Foundations

### [x] Task 5.1 — Add tests for permission/path/SSRF edge cases
### [x] Task 5.2 — Add storage + approval unit tests
### [x] Task 5.3 — Add browser package tests + minimal integration smoke
### [x] Task 5.4 — Raise engine/tools coverage for critical paths
Done: engine ~19%, tools ~26%, total ~34% (was ~19% overall / engine ~4%).
### [x] Task 5.5 — Add govulncheck to CI

---

## Phase 6 — DevOps / Operability

### [x] Task 6.1 — CI completeness (lint + coverage gate)
Done: `make lint`, `make coverage-gate` (default min 20%), CI runs both.
### [x] Task 6.2 — Document Docker runtime usage (no K8s yet)
Done: README + GETTING_STARTED Docker section; Dockerfile non-root + health port.
### [x] Task 6.3 — Daemon health/readiness beyond browser `/health`
Done: `pkg/health` + `--health-addr` (default `127.0.0.1:8766`) `/healthz` `/readyz`.

---

## Phase 7 — Architecture Integration

### [x] Task 7.1 — Wire HTN planner behind `features.use_htn_planner`
Done: `pkg/planner/htn_bridge.go` + engine wiring with v1 fallback.
### [x] Task 7.2 — Implement DAG executor behind `features.use_dag_executor`
Done: `pkg/executor` Scheduler used when flag enabled.
### [x] Task 7.3 — Capability registry wiring (`use_capabilities`)
Done: builtin registry registered when HTN or capabilities flag is on.
### [x] Task 7.4 — Defer AG2 / MCP / vector memory until foundations exist
Done: flags remain false/unimplemented in example config and docs.

---

## Explicitly Out of Scope Until Approved

- Implementing AG2 / MCP / vector DB
- Kubernetes / Helm / Terraform
- Large engine rewrite without feature flags
- Any production exposure of browser WebSocket beyond localhost
54 changes: 37 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.PHONY: build install clean test lint run-daemon run-cli
.PHONY: build install clean test lint run-daemon run-cli test-coverage coverage-gate live-test

# Build variables
BINARY_DAEMON=octa-agentd
BINARY_CLI=octa-agent
BUILD_DIR=./bin
CMD_DAEMON=./cmd/octa-agentd
CMD_CLI=./cmd/octa-agent
COVERAGE_MIN ?= 20

# Build flags
LDFLAGS=-ldflags "-s -w"
Expand Down Expand Up @@ -40,13 +41,25 @@ test:

test-coverage:
@echo "Running tests with coverage..."
go test -v -coverprofile=coverage.out ./...
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html

# Fail if total statement coverage is below COVERAGE_MIN (default 20%).
coverage-gate: test-coverage
@total=$$(go tool cover -func=coverage.out | awk '/^total:/ {print $$3}' | tr -d '%'); \
echo "Total coverage: $${total}% (min $(COVERAGE_MIN)%)"; \
awk -v t="$$total" -v m="$(COVERAGE_MIN)" 'BEGIN { exit (t+0 < m+0) }' || \
(echo "coverage $${total}% is below gate $(COVERAGE_MIN)%" && exit 1)

lint:
@echo "Running linter..."
@which golangci-lint > /dev/null || (echo "golangci-lint not installed" && exit 1)
golangci-lint run
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run; \
else \
echo "golangci-lint not installed; running go vet + gofmt check"; \
go vet ./...; \
test -z "$$(gofmt -l . | grep -v vendor || true)" || (gofmt -l . && exit 1); \
fi

run-daemon: build-daemon
@echo "Starting octa-agentd..."
Expand All @@ -56,6 +69,11 @@ run-cli: build-cli
@echo "Running octa-agent..."
$(BUILD_DIR)/$(BINARY_CLI)

# End-to-end smoke against a live Ollama instance (not for CI by default).
live-test: build
@echo "Running live end-to-end smoke test..."
@./scripts/live-test.sh

deps:
@echo "Downloading dependencies..."
go mod download
Expand All @@ -71,16 +89,18 @@ vet:

help:
@echo "Available targets:"
@echo " build - Build all binaries"
@echo " build-daemon - Build octa-agentd"
@echo " build-cli - Build octa-agent"
@echo " install - Install binaries to GOPATH"
@echo " clean - Remove build artifacts"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " lint - Run linter"
@echo " run-daemon - Build and run daemon"
@echo " run-cli - Build and run CLI"
@echo " deps - Download dependencies"
@echo " fmt - Format code"
@echo " vet - Vet code"
@echo " build - Build all binaries"
@echo " build-daemon - Build octa-agentd"
@echo " build-cli - Build octa-agent"
@echo " install - Install binaries to GOPATH"
@echo " clean - Remove build artifacts"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " coverage-gate - Fail if coverage < COVERAGE_MIN (default 20)"
@echo " lint - Run linter (golangci-lint or vet/gofmt)"
@echo " run-daemon - Build and run daemon"
@echo " run-cli - Build and run CLI"
@echo " live-test - E2E smoke (daemon+CLI+Ollama; requires ollama/sqlite3)"
@echo " deps - Download dependencies"
@echo " fmt - Format code"
@echo " vet - Vet code"
Loading
Loading