Commit Graph

654 Commits

Author SHA1 Message Date
Levi Neely 8be8b9c42d task state: read PlanStep from plan file (ground truth) with text fallback 2026-05-17 11:09:44 +02:00
Levi Neely 837c95c483 state: expose estimateTokens/stripCold on interface; remove type assertion 2026-05-17 11:06:45 +02:00
Levi Neely 62774e60a6 session: strip cold results at restore time to eliminate resume hot spot 2026-05-17 11:05:27 +02:00
Levi Neely d1ac24fb1d loop: auto-infer TaskState from actual tool results each round 2026-05-17 11:04:55 +02:00
Levi Neely bfc7f15254 tier: built-in default cold table for known read-only tools 2026-05-17 11:03:54 +02:00
Levi Neely 1cf171adae loop: proactive cold stripping at 50% context budget before backend call 2026-05-17 11:01:21 +02:00
Levi Neely 779b99fd9b tool results: tier classification (hot/warm/cold) with immediate cold summarization 2026-05-17 10:59:17 +02:00
Levi Neely da36db8f2b loop: introduce StepContext — per-turn context object assembled once 2026-05-17 10:54:10 +02:00
Levi Neely fa88c89369 compact: tiered compaction — cold (summary), warm (decision index), hot (verbatim tail) 2026-05-17 10:52:48 +02:00
Levi Neely ea4a3084e0 session: add Checkpoint for typed subflow handoff 2026-05-17 10:15:24 +02:00
Levi Neely b5b2ee43ec loop: replace plan file re-injection with structured TaskState re-injection 2026-05-17 10:14:44 +02:00
Levi Neely 283a2e24d8 state: extend interface with recentHistory/taskState; loop uses selective context 2026-05-17 10:10:33 +02:00
Levi Neely 54351e8c85 compact: structured TaskState compaction with recent message tail 2026-05-17 10:08:33 +02:00
Levi Neely b775e5df7a agent: add TaskState — persisted structured overlay injected at each turn 2026-05-17 10:06:21 +02:00
Levi Neely 45959cb79d agent: apply config backend/model when switching agents via /agent 2026-05-17 00:19:55 +02:00
Levi Neely 8c3b40ffe1 config: add backend and model fields 2026-05-17 00:15:39 +02:00
Levi Neely 22d72f143d fix: wire allowExecutors/allowTools in BuildAgentEnv; add missing IncrToolCallCount field 2026-05-17 00:05:34 +02:00
Levi Neely 161d0d237f add allowExecutors/allowTools two-layer tool restriction 2026-05-16 23:54:55 +02:00
Levi Neely 3867d52689 add generation params: top_p, top_k, min_p, top_a, repetition_penalty, max_completion_tokens, response_format, reasoning_effort, include_reasoning, stop, verbosity 2026-05-16 23:54:04 +02:00
Levi Neely 6dfae368d0 fix: wire PlanFile, add missing rate-limit constants, simplify test helpers, fix regex
- Wire PlanFile from $OLLIE/s/{id}/plan into agentConfig so plan
  re-injection is no longer dead code
- Add missing failureWindow/maxFailures/blockDuration constants
- Replace hand-rolled contains() with strings.Contains
- Fix rm -rf .. regex to match end-of-string and whitespace
- Add TestPlanReinjection covering periodic plan re-surfacing
- Add loop_maxsteps_helpers_test.go with mockResponse/newState/sequentialStream
2026-05-16 23:54:04 +02:00
Levi Neely 35a78169e5
Merge pull request #3 from lneely/feat/configurable-max-steps
agent: configurable MaxSteps override in AgentCoreConfig + /maxsteps command
2026-05-16 21:53:44 +00:00
Levi Neely 2101a2c023 agent: add MaxSteps override in AgentCoreConfig and /maxsteps command
- AgentCoreConfig.MaxSteps: when non-zero, overrides the value loaded
  from the agent JSON (cfg.Env.maxSteps). Zero means "use the agent
  JSON value, or unlimited if absent". Callers (9p frontend, httpgw,
  CLI) can now inject a per-session limit at construction time without
  touching any agent config file.

- /maxsteps [n] command: shows the current limit (0 = unlimited) or
  sets it live during a session. Follows the same pattern as /model.
  Added to /help listing.
2026-05-16 18:56:39 +00:00
Levi Neely d8467a4f16 agent: add ToolCallCount to Core interface; wire tcct accumulator
Adds a monotonically increasing tool-call counter (tcct) to the agent.

- atomic.Int64 toolCallCount on the agent struct
- ToolCallCount() int64 on the Core interface
- IncrToolCallCount func() int64 on agentConfig, wired in executeTurn
- Incremented in execOne after the pre-tool hook returns (blocked calls
  don't count) and before cfg.Exec is called (timeout/error still counts)

The counter never resets. Consumers use modulo arithmetic:
  tcct % 10 == 0  ->  fires every 10 actual executions

The primary consumer is ollie-9p, which exposes tcct as a read-only
9P file that pre_tool / post_tool hooks can inspect via cat.
2026-05-15 20:16:43 +00:00
Levi Neely 4fdf5e042d loop: re-surface plan file every 10 tool rounds; nudge includes plan reminder 2026-05-15 19:48:13 +00:00
Levi Neely 0d9405f9bc core: read MaxSteps from config into agentConfig 2026-05-15 19:33:44 +00:00
Levi Neely 7702ae4080 config,core: wire MaxSteps from agent JSON through to agentConfig loop 2026-05-15 19:27:44 +00:00
Levi Neely c20a5203ca agent: add MaxSteps soft guardrail to agentConfig and loop 2026-05-15 19:25:10 +00:00
Levi Neely 46940eef07 docs: remove misplaced OBSERVATIONS.md (belongs in ollie/doc) 2026-05-15 18:59:26 +00:00
Levi Neely 21e6c0954b docs: add OBSERVATIONS.md 2026-05-15 18:58:25 +00:00
Levi Neely 860b1ce64d execute: fix test suite — Yolo mode for CI, correct classifyStep expectation 2026-05-15 18:54:20 +00:00
Levi Neely 8cf82f3551 execute: update tests for split execute_code / call_tool / pipe tools 2026-05-15 18:50:20 +00:00
Levi Neely 0903254c6c execute: wire call_tool and pipe dispatch; execute_code is code-only 2026-05-15 18:48:23 +00:00
Levi Neely f8299effdf execute: split execute_code into execute_code, call_tool, pipe 2026-05-15 18:47:07 +00:00
Levi Neely b6308f1a13 agent: log prompt resolution errors to stderr 2026-05-11 14:13:44 +02:00
Levi Neely c02607aa60 execute: separate steps (parallel) from pipe (sequential)
- steps: independent, run in parallel when annotated safe, outputs
  concatenated. No stdout chaining.
- pipe: explicit pipeline, sequential, stdout of each stage feeds
  stdin of the next.

steps and pipe are mutually exclusive in a single execute_code call.
2026-05-11 13:50:01 +02:00
Levi Neely d638c2e75b Revert "execute: remove auto-batching from pipeline, fan-out is always explicit"
This reverts commit 2117f14a53.
2026-05-11 13:43:13 +02:00
Levi Neely 2117f14a53 execute: remove auto-batching from pipeline, fan-out is always explicit
steps is always a pipe (sequential, stdout chains to next stdin).
Concurrent fan-out requires explicit use of the parallel field.
The ollie:parallel annotation still drives agent-level tool call
parallelism via IsParallelRead, but no longer hijacks pipe semantics.
2026-05-11 13:40:47 +02:00
Levi Neely 36841b3667 execute/flock: make ollie:parallel annotation comment-syntax-agnostic
Now matches "ollie:parallel" anywhere in the line instead of requiring
a "# " prefix. Supports bash (#), lua (--), C-style (//), etc.
2026-05-11 13:26:55 +02:00
Levi Neely 76697ab597 fix TestCommand_Agents_Empty: set OLLIE_AGENTS_PATH 2026-05-08 13:02:03 +02:00
Levi Neely a2b6adb6cf env: add OLLIE_AGENTS_PATH with colon-separated multi-dir resolution 2026-05-08 13:01:04 +02:00
Levi Neely 0041fc77ec add OLLIE_PROMPTS_PATH env var and PromptsDirs helper 2026-05-08 11:59:16 +02:00
Logan Neely cafc55e038 execute: add Strict and Yolo server options
Strict rejects inline {code} steps, allowing only named {tool} steps.
Yolo skips the landrun sandbox entirely.
2026-05-07 22:27:22 +02:00
Levi Neely 1279f10218 fix: remove cancelled tool calls from assistant messages
After interrupt, tool results with cancelled status are removed but
the assistant message kept its ToolCalls referencing them, causing
'Improperly formed request' errors.

Now also strips cancelled tool call IDs from assistant messages.
Only removes the assistant message entirely if it has zero remaining
tool calls AND no text content.
2026-05-04 16:54:04 +02:00
Levi Neely e6233626bc speed up agent tests
- Add configurable retryBaseDelay and streamDropBaseDelay for tests
- Fix hook kill: don't wait for done channel after Kill() since child
  processes may keep stdout/stderr pipes open
- Update tests to use short delays

Tests now run in ~0.4s instead of ~59s.
2026-05-04 11:58:01 +02:00
Levi Neely a9c7600d6e prompt: remove newline heuristic from exec prompt
All array entries in prompt config are now shell commands.
Removes the special case that treated entries with newlines as literal text.
2026-05-04 11:33:16 +02:00
Levi Neely f9b2b50274 agent: preserve completed work on interrupt/error
- On interrupt or error, keep user message, assistant response, and
  completed tool results (success or error)
- Only remove cancelled/interrupted tool results
- Use deep copy for message snapshots to prevent aliasing bugs
- Snapshot now only used for context overflow retry
2026-05-04 10:23:56 +02:00
ollie 36d3021aae sandbox: require landrun, fail hard if unavailable
WrapCommand now returns an error instead of silently falling back to
unsandboxed execution when landrun is not in PATH. execute_code
propagates this as a hard failure.
2026-05-03 22:10:02 +02:00
Levi Neely 6422c365b7 agent: deduplicate identical tool calls within parallel batches
Identical read-safe tool calls in the same batch now execute only
once. Duplicates get the result copied with the correct ToolCallID.
Fixes a race where concurrent goroutines both missed the cache
before either could store, causing double execution.
2026-05-03 21:27:46 +02:00
Levi Neely 3c5d92b461 agent: roll back session on interrupt, clean error message
On user interrupt (stop/CTRL+C), the session history now rolls back
to the pre-turn snapshot instead of keeping partial/cancelled tool
results in the model's context. This prevents raw errors like
'context canceled' from poisoning subsequent turns.

Tool results interrupted by cancellation now report 'tool execution
interrupted by user' instead of the raw Go error chain.
2026-05-03 21:10:28 +02:00
Levi Neely c069deccca config: add tools bool to disable tool collection per agent
When tools is false in agent config, BuildAgentEnv skips ListTools
entirely so no tool schemas are sent to the backend. Models without
tool support now work cleanly.
2026-05-03 14:58:58 +02:00