Commit graph

45 commits

Author SHA1 Message Date
Snider
b77c590f61 chore: bump forge.lthn.ai dep versions to latest tags
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 8m38s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-26 05:34:23 +00:00
67d7ebec58 Merge pull request 'chore: Go 1.26 modernization' (#3) from chore/go-1.26-modernization into main
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 5m53s
2026-02-24 18:01:49 +00:00
Claude
72c17b2382
chore: sort.Slice → slices.SortFunc
All checks were successful
Security Scan / security (pull_request) Successful in 11s
Test / test (pull_request) Successful in 5m37s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:28:05 +00:00
Claude
cbd0c5f22b
chore: fmt.Errorf(static) → errors.New
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:27:42 +00:00
Snider
3b9e0e7a4c chore: bump forge.lthn.ai dep versions to latest tags
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 9m53s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:49:36 +00:00
Snider
214658602a chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:45:30 +00:00
Snider
2f2839a6ea chore: refresh go.sum after upstream tag updates
Some checks failed
Security Scan / security (push) Successful in 10s
Test / test (push) Failing after 23s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:35:18 +00:00
Snider
1e263febf2 feat: modernise to Go 1.26 iterators and stdlib helpers
Some checks failed
Security Scan / security (push) Successful in 7s
Test / test (push) Failing after 39s
Add iter.Seq iterators for AgentRegistry (AllSeq) and AllowanceStore
(ListSeq) across all backends (sqlite, redis). Use slices.SortFunc,
slices.Contains, maps.Keys in dispatcher and router.

Co-Authored-By: Gemini <noreply@google.com>
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:08:13 +00:00
Claude
b2286b46d7
ci: add Forgejo Actions test and security scan workflows
Some checks failed
Security Scan / security (push) Successful in 13s
Test / test (push) Failing after 38s
Uses reusable workflows from core/go-devops for Go testing
(with race detector and coverage) and security scanning
(govulncheck, gitleaks, trivy).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 03:28:02 +00:00
Claude
d287a5fc84
chore: refresh go.sum after upstream tag updates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 23:36:25 +00:00
Snider
6c3b5989e6 refactor: migrate CLI imports from core/go to core/cli
Update imports from forge.lthn.ai/core/go/pkg/cli to
forge.lthn.ai/core/cli/pkg/cli following CLI package split.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 23:29:39 +00:00
Claude
742dd8edfe
chore: sync workspace dependency versions
Run go work sync to align dependency versions across workspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:41:50 +00:00
Snider
6970da5c49 refactor: apply go fix modernizers for Go 1.26
Automated fixes: interface{} → any, range-over-int, t.Context(),
wg.Go(), strings.SplitSeq, strings.Builder, slices.Contains,
maps helpers, min/max builtins.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 21:00:17 +00:00
Snider
bfc855da5b chore: go mod tidy for 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:35:59 +00:00
Snider
21f05532fd chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:49 +00:00
Snider
f5e49280ac chore: pin forge deps to v0.0.1 tags for Go 1.26 compat
Go 1.26 rejects non-semver version strings (like 'main') in go.mod.
Tags v0.0.1 now exist on all forge repos — workspace still overrides
for local development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:15:05 +00:00
Snider
49c218aa94 chore: use workspace-resolved versions, drop replace directives
Forge module versions now use main branch resolution via ~/Code/go.work
workspace. Removes local replace directives — the central go.work handles
all cross-repo resolution during development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 19:49:36 +00:00
Snider
ecb7f406f2 refactor: remove init() + RegisterCommands pattern
Commands now register through Core framework lifecycle via
cli.WithCommands() instead of side-channel init() functions.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 22:07:14 +00:00
Snider
45a78d77bc feat: absorb workspace command from CLI
Workspace, agent, and task management commands.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 21:46:16 +00:00
Snider
65e3ef4d49 feat: migrate task commands from CLI
Move task list/view/claim/update/complete commands from core/cli cmd/ai
into go-agentic where they belong.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 20:42:16 +00:00
Snider
ad0cf5c932 chore: resolve forge deps from registry, remove local replaces
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:19:48 +00:00
Snider
1e23935ad4 docs: add README with quick start and docs links
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:11:19 +00:00
Snider
6e8ae2a1ec docs: graduate TODO/FINDINGS into production documentation
Replace internal task tracking (TODO.md, FINDINGS.md) with structured
documentation in docs/. Trim CLAUDE.md to agent instructions only.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:02:20 +00:00
Claude
4628b2b094
feat(events): add Close() method to ChannelEmitter
Allows consumers to signal the drain goroutine to stop by closing
the underlying channel. Used by CLI dispatch watch cleanup.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 12:46:48 +00:00
Claude
a29ded5159
feat(events): Phase 8 — event hooks for task lifecycle and quota notifications
EventEmitter interface with ChannelEmitter (buffered, non-blocking) and
MultiEmitter (fan-out). Wired into Dispatcher (5 event types) and
AllowanceService (3 event types). 20 new tests, all passing under -race.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 12:02:30 +00:00
Snider
e7b7459353 docs: mark Phase 7 complete in TODO
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 11:48:48 +00:00
Snider
ba8c19d32f feat(dispatch): Phase 7 — priority-ordered dispatch with retry backoff and dead-letter
Sort pending tasks by priority (Critical > High > Medium > Low) with
oldest-first tie-breaking before dispatch. Add exponential backoff for
failed dispatches (5s, 10s, 20s...) and dead-letter tasks that exceed
MaxRetries (default 3) by marking them StatusFailed via UpdateTask.

New Task fields: MaxRetries, RetryCount, LastAttempt, FailReason.
New constant: StatusFailed.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:47:47 +00:00
Snider
ce502c0f16 feat(registry): Phase 5 — persistent agent registry (SQLite + Redis + config factory)
Add SQLiteRegistry and RedisRegistry implementations of the AgentRegistry
interface, mirroring the AllowanceStore persistence pattern. SQLiteRegistry
uses modernc.org/sqlite directly with a proper agents table schema, WAL mode,
and UPSERT semantics. RedisRegistry uses go-redis/v9 with TTL-based natural
reaping and SCAN for listing. Add RegistryConfig struct and
NewAgentRegistryFromConfig factory function to config.go.

Full test parity with existing MemoryRegistry tests, including concurrent
access under -race, persistence round-trip, and skip-if-no-Redis pattern.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 11:40:46 +00:00
Snider
779132a3b9 fix(config): change DefaultBaseURL to localhost, annotate reserved fields
- DefaultBaseURL was api.core-agentic.dev (nonexistent domain). Changed
  to http://localhost:8080 for local dev. Set AGENTIC_BASE_URL for prod.
- HourlyRateLimit and CostCeiling on ModelQuota annotated as reserved:
  stored but not enforced. Enforcement requires AllowanceStore interface
  changes (sliding window) — deferred.
- Phase 6 marked complete in TODO.md.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 11:37:18 +00:00
Snider
e86cb1c6a3 docs: add Phases 5-8 to TODO — registry persistence, rate enforcement, retry, events
Phase 5: SQLite + Redis AgentRegistry (mirrors AllowanceStore pattern)
Phase 6: Enforce or remove dead HourlyRateLimit/CostCeiling fields
Phase 7: Priority-ordered dispatch with retry backoff and dead-letter
Phase 8: EventEmitter interface for task lifecycle notifications

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 11:35:19 +00:00
Claude
092f19e7a0
docs: mark Redis backend as done in TODO.md
Virgil committed Redis AllowanceStore at 0be744e.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 11:29:15 +00:00
Claude
9636cdb8ff
fix(test): mock claude binary in HandleTask tests
Tests were spawning real claude subprocess, causing 55s+ runtime and
failures on machines where claude is installed. Use PATH-prepended mock
script (exit 1) — same pattern as existing gh mocks. Suite now runs in
~5s.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 11:28:03 +00:00
Claude
6cb02564f4
fix(test): correct concurrent dispatch test allowance override
registerAgent hardcodes ConcurrentJobs: 5, but the concurrent test
launches 10 goroutines. Override with ConcurrentJobs: 0 (unlimited)
so all 10 dispatches succeed as intended.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 11:23:30 +00:00
Snider
0be744e46a feat(allowance): add Redis backend for AllowanceStore
Implements RedisStore using github.com/redis/go-redis/v9 with Lua
scripts for atomic increment/decrement operations. Adds functional
options (WithRedisPassword, WithRedisDB, WithRedisPrefix), config
wiring via "redis" store_backend, and comprehensive tests covering
all 10 interface methods, concurrency, persistence, and error paths.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:23:13 +00:00
Snider
46e3617f9c docs: add commit hash to TODO.md Phase 4 completion
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:22:16 +00:00
Snider
ef81db73c1 feat(cli): add status summary, task submission, and log streaming
CLI backing functions for core agent commands:
- GetStatus/FormatStatus aggregates registry + client + allowance data
- SubmitTask + Client.CreateTask for task creation
- StreamLogs polls task updates to io.Writer

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:21:59 +00:00
Snider
b03e4c1e0b docs: add commit hash to TODO.md Phase 3 completion
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:17:09 +00:00
Snider
646cc0261b feat(coordination): add agent registry, task router, and dispatcher
Multi-agent coordination layer:
- AgentRegistry interface + MemoryRegistry (heartbeat, reap, discovery)
- TaskRouter interface + DefaultRouter (capability matching, load balancing)
- Dispatcher orchestrates registry + router + allowance for task dispatch

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:16:53 +00:00
Snider
3e43233e0e feat: Phase 2 — SQLite AllowanceStore backend + config wiring
Add persistent storage for agent allowance quotas using go-store (SQLite KV).
SQLiteStore implements all 11 AllowanceStore methods with JSON serialisation,
mutex-guarded read-modify-write for atomic increments, and proper
time.Duration handling via nanosecond int64 encoding.

- allowance_sqlite.go: full AllowanceStore implementation with 4 KV groups
- allowance_sqlite_test.go: 26 tests covering CRUD, persistence across
  close/reopen, concurrent access (10 goroutines), and AllowanceService
  integration
- config.go: AllowanceConfig struct + NewAllowanceStoreFromConfig factory
- go.mod: add forge.lthn.ai/core/go-store dependency

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 07:07:49 +00:00
Claude
5d0269511e
test: push coverage from 85.6% to 96.5%
Add comprehensive tests for previously uncovered code paths:
- service.go: NewService, OnStartup, handleTask, doCommit, doPrompt
- completion.go: CreatePR with mock gh binary, PushChanges success path
- allowance_service.go: ResetAgent error path with mock store
- client.go: connection refused and invalid JSON paths for all methods
- Additional edge cases for CreateBranch, AutoCommit, generateBranchName

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 02:24:06 +00:00
Claude
e6b9919d91
docs: add commit hash to TODO.md Phase 1 completion
Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 01:00:13 +00:00
Claude
23aa635c91
test: achieve 85.6% coverage with 7 new test files
Phase 1 complete: coverage from 70.1% to 85.6% (130+ tests, all passing).

New test files:
- lifecycle_test.go: full claim -> process -> complete integration flows
- allowance_edge_test.go: boundary conditions for token/job/concurrent limits
- allowance_error_test.go: mock errorStore covering all RecordUsage error paths
- embed_test.go: Prompt() hit/miss and content trimming
- service_test.go: DefaultServiceOptions, TaskPrompt, TaskCommit type coverage
- completion_git_test.go: real git repos for AutoCommit, CreateBranch, CommitAndSync
- context_git_test.go: findRelatedCode with keyword search, file limits, truncation

Updated config_test.go with YAML fallback, env override, and empty-dir paths.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 00:59:58 +00:00
Claude
af110becc1
fix: correct go.mod replace directive (../core → ../go)
Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 00:48:29 +00:00
Virgil
2f384d494c docs: add TODO.md for fleet delegation
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 21:36:06 +00:00
Snider
68c108f62e feat: extract go-agentic from go-ai as standalone service package
AI service lifecycle, allowance management, CLI task client.
Zero internal go-ai dependencies. Adds CLAUDE.md/TODO.md/FINDINGS.md.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 18:28:36 +00:00