Compare commits

...

11 Commits

Author SHA1 Message Date
bicabone
c5dcccfd7e .gitignore 2025-11-13 16:00:33 -05:00
bicabone
1f7086fe03 feat: Add sprint documents for feature-bench testing
- Added uninstaller feature sprint (Issue #3900)
- Added maxSteps feature sprint (Issue #3631)
- These sprints will be used by feature-bench test suite
2025-11-12 22:24:50 -05:00
GitHub Action
5f1417f1a1 ignore: update download stats 2025-11-12 2025-11-12 12:01:58 +00:00
GitHub Action
740f9dadef ignore: update download stats 2025-11-11 2025-11-11 12:01:53 +00:00
GitHub Action
4b66048e2b ignore: update download stats 2025-11-10 2025-11-10 12:01:54 +00:00
GitHub Action
e019b097ff ignore: update download stats 2025-11-09 2025-11-09 12:01:42 +00:00
GitHub Action
7409236838 ignore: update download stats 2025-11-08 2025-11-08 12:01:48 +00:00
GitHub Action
7caf149e46 ignore: update download stats 2025-11-07 2025-11-07 12:01:41 +00:00
GitHub Action
f1db3a2d29 ignore: update download stats 2025-11-06 2025-11-06 12:01:52 +00:00
GitHub Action
c454918144 ignore: update download stats 2025-11-05 2025-11-05 12:01:44 +00:00
GitHub Action
c5153772c6 ignore: update download stats 2025-11-04 2025-11-04 12:02:03 +00:00
4 changed files with 195 additions and 0 deletions

6
.gitignore vendored
View File

@@ -11,3 +11,9 @@ playground
tmp
dist
.turbo
# Test suite artifacts
opencode/.bun/
opencode/.local/
opencode/.cache/
opencode/node_modules

View File

@@ -129,3 +129,12 @@
| 2025-11-01 | 636,100 (+9,488) | 581,806 (+17,227) | 1,217,906 (+26,715) |
| 2025-11-02 | 644,067 (+7,967) | 590,004 (+8,198) | 1,234,071 (+16,165) |
| 2025-11-03 | 653,130 (+9,063) | 597,139 (+7,135) | 1,250,269 (+16,198) |
| 2025-11-04 | 663,907 (+10,777) | 608,056 (+10,917) | 1,271,963 (+21,694) |
| 2025-11-05 | 675,059 (+11,152) | 619,690 (+11,634) | 1,294,749 (+22,786) |
| 2025-11-06 | 686,249 (+11,190) | 630,885 (+11,195) | 1,317,134 (+22,385) |
| 2025-11-07 | 696,626 (+10,377) | 642,146 (+11,261) | 1,338,772 (+21,638) |
| 2025-11-08 | 706,032 (+9,406) | 653,489 (+11,343) | 1,359,521 (+20,749) |
| 2025-11-09 | 713,462 (+7,430) | 660,459 (+6,970) | 1,373,921 (+14,400) |
| 2025-11-10 | 722,280 (+8,818) | 668,225 (+7,766) | 1,390,505 (+16,584) |
| 2025-11-11 | 729,769 (+7,489) | 677,501 (+9,276) | 1,407,270 (+16,765) |
| 2025-11-12 | 740,168 (+10,399) | 686,454 (+8,953) | 1,426,622 (+19,352) |

View File

@@ -0,0 +1,101 @@
# Sprint: Agent MaxSteps Feature
## Problem Statement
Users need the ability to limit the number of steps that agents (especially subagents) can take during execution, as outlined in [Issue #3631](https://github.com/sst/opencode/issues/3631). This feature will prevent runaway agent loops and give users better control over agent execution limits.
## Context
### Existing System
OpenCode has an agentic loop system controlled in `packages/opencode/src/session/prompt.ts`. Currently, agents can run indefinitely without any step limits, which can lead to:
- Excessive resource consumption
- Runaway loops in faulty agent logic
- Unpredictable costs when using paid APIs
- Difficulty in debugging agent behavior
### MaxSteps Feature Requirements
The maxSteps feature must:
- Allow optional step limits for agent definitions
- Work for both primary agents and subagents (primary use case is subagents)
- Stop execution when the limit is reached
- On the n-1 step, remove all tools from the request to force a text-only response
- Be configurable per agent definition
- Default to unlimited if not specified (backward compatibility)
## Success Criteria
- [ ] Agent definitions accept optional `maxSteps` parameter
- [ ] Step counter tracks execution steps accurately
- [ ] Agent stops at maxSteps limit
- [ ] On step n-1, tools are removed from the request
- [ ] Final step produces a text-only response summarizing status
- [ ] Feature works for both primary and subagents
- [ ] No breaking changes to existing agent definitions
- [ ] Step limit is logged for debugging purposes
- [ ] Clear error/status message when limit is reached
- [ ] Tests cover various step limit scenarios
- [ ] Documentation updated with maxSteps usage
## Technical Requirements
### Agent Definition Schema
```typescript
interface AgentDefinition {
name: string;
description: string;
tools?: Tool[];
maxSteps?: number; // New optional field
// ... other existing fields
}
```
### Implementation Location
- Primary implementation in: `packages/opencode/src/session/prompt.ts`
- Agent definition types updated
- Step counter logic added to agentic loop
### Step Counting Logic
1. Initialize step counter when agent starts
2. Increment counter after each tool execution
3. Check if current step === maxSteps - 1
- If true: Remove tools from next request
4. Check if current step === maxSteps
- If true: Stop execution and return final response
### Edge Cases to Handle
- maxSteps = 0 (should be invalid)
- maxSteps = 1 (immediate text response)
- maxSteps = 2 (one tool call, then text)
- Nested subagent calls (each has own counter)
- Error handling when limit reached mid-operation
## Testing Strategy
1. Unit tests for step counter logic
2. Integration tests with mock agents
3. Test various maxSteps values (1, 2, 10, undefined)
4. Test tool removal on n-1 step
5. Test nested agent scenarios
6. Test error cases and boundary conditions
7. Performance tests to ensure no overhead when maxSteps not used
## Validation Checklist
- [ ] maxSteps parameter accepted in agent definitions
- [ ] Step counter increments correctly
- [ ] Execution stops at limit
- [ ] Tools removed on penultimate step
- [ ] Final response is text-only
- [ ] No regression in unlimited agents
- [ ] Logs show step count and limit
- [ ] Clear status message on limit reached
- [ ] Tests pass for all scenarios
- [ ] Documentation includes examples
## Example Usage
```typescript
const limitedAgent = {
name: "limited-helper",
description: "An agent with step limits",
maxSteps: 5, // Will stop after 5 steps
tools: [/* ... tools ... */]
};
// On step 4, tools will be removed
// On step 5, execution stops with text response
```

View File

@@ -0,0 +1,79 @@
# Sprint: OpenCode Uninstaller Feature
## Problem Statement
Users need a reliable way to completely remove OpenCode from their system, including all configuration files, cached data, and installed components, as outlined in [Issue #3900](https://github.com/sst/opencode/issues/3900).
## Context
### Existing System
OpenCode is a CLI tool that installs various components and configurations across the system. Currently, there is no comprehensive uninstall command that cleanly removes all traces of the installation.
### Uninstaller Feature Requirements
The uninstaller must provide a complete removal process that:
- Removes the OpenCode binary/executable
- Cleans up configuration files from user directories
- Removes cached data and temporary files
- Provides options for selective removal (keep configs, etc.)
- Confirms actions before destructive operations
## Success Criteria
- [ ] Uninstall command (`opencode uninstall`) is available in the CLI
- [ ] Command removes OpenCode executable from installation path
- [ ] Configuration files in ~/.opencode are removed (with --all flag)
- [ ] Cache directories are cleaned up
- [ ] User is prompted for confirmation before removal
- [ ] Option to keep configuration files (--keep-config)
- [ ] Uninstaller provides clear feedback on what was removed
- [ ] Process is reversible by reinstalling OpenCode
- [ ] Exit code 0 on successful uninstallation
- [ ] Comprehensive error handling for permission issues
- [ ] Documentation updated with uninstall instructions
## Technical Requirements
### CLI Interface
```bash
opencode uninstall [options]
--all Remove everything including configs
--keep-config Keep configuration files
--force Skip confirmation prompts
--dry-run Show what would be removed without doing it
```
### File Locations to Handle
- **Binary**: `/usr/local/bin/opencode` or installation path
- **Config**: `~/.opencode/` directory
- **Cache**: `~/.cache/opencode/` directory
- **Temp**: `/tmp/opencode-*` files
- **Logs**: `~/.opencode/logs/` directory
### Implementation Steps
1. Parse command arguments and flags
2. Identify all OpenCode-related files and directories
3. Show user what will be removed (with confirmation)
4. Remove files in correct order (temp -> cache -> config -> binary)
5. Verify removal and report status
6. Clean up any remaining symlinks or PATH entries
### Error Handling
- Permission denied errors should suggest using sudo
- Missing files should not cause failure
- Partial uninstall should be reported clearly
- Network operations should have timeout handling
## Testing Strategy
1. Install OpenCode in a test container
2. Create configuration and cache files
3. Run uninstall command with various flags
4. Verify complete removal of all components
5. Test edge cases (permissions, missing files, etc.)
6. Validate that reinstallation works after uninstall
## Validation Checklist
- [ ] Binary file removed from system
- [ ] Config directory removed (when using --all)
- [ ] Cache directory cleaned up
- [ ] No orphaned files remain
- [ ] PATH environment cleaned if modified
- [ ] Exit codes match expected values
- [ ] Help text includes uninstall command
- [ ] Man page or docs updated