Files
openworker/docs/config.example.toml
T
Devika Verma 2c91bd9a22 Make the per-reply output-token limit configurable (OPE-177)
Every provider capped each reply with a hard-coded constant (32,000 for the
Anthropic and OpenAI-compatible clients, 4,096 for Bedrock) that no config,
environment variable or CLI option could change, although `build_engine(...,
model_settings=)` already spread settings into every provider call and every
provider used `setdefault("max_tokens", ...)`. Now:

- `Config.max_output_tokens` (config.toml, workspace-overridable; env override
  `COWORKER_MAX_OUTPUT_TOKENS`), validated as a positive integer; unset keeps
  every provider's default byte-for-byte.
- `build_engine` folds it into `model_settings["max_tokens"]` unless the caller
  passed an explicit value; explorer subagents inherit it.
- `AssistantTurn.output_limit`: the ceiling the provider actually sent, after
  the Anthropic budget-thinking floor (which now logs a warning when it
  overrides a configured value) or the OpenAI `max_completion_tokens` rename.
- The engine persists it on the assistant message as the `max_output_tokens`
  sidecar and on the ASSISTANT_MESSAGE event, stripped before provider calls.
- Bedrock keeps 4,096 with a comment on why; the config key raises it.
- docs/config.example.toml documents the key.

Tests: tests/test_max_output_tokens.py (config layering, env override,
validation, build_engine plumbing, Anthropic complete/stream + floor warning,
OpenAI complete/stream + rename retry, engine record).
2026-09-08 17:08:29 +05:30

28 lines
1.2 KiB
TOML

# coworker config — copy to one of:
# ~/.config/coworker/config.toml (global)
# <your-project>/.coworker/config.toml (per-workspace, overrides global)
#
# All keys are optional; unset keys fall back to built-in defaults.
model = "gpt-5.5" # default model id (override per session in the UI/CLI)
mode = "interactive" # plan | interactive | auto | custom
max_iterations = 12 # max model<->tool iterations per turn before stopping
# max_output_tokens = 64000 # per-reply output cap sent as max_tokens (thinking + text +
# tool arguments). Unset = provider default (32000; Bedrock
# 4096). Env override: COWORKER_MAX_OUTPUT_TOKENS.
# Commands auto-allowed without an approval prompt (prefix match).
allowed_commands = [
"ls", "cat", "pwd", "grep", "find",
"git status", "git diff", "git log",
"python3", "pytest", "node", "npm",
]
# In "custom" permission mode, these tools are auto-approved (everything else still
# asks). e.g. auto-accept file edits but keep asking before running shell commands.
auto_allow = ["write_file", "replace_in_file", "apply_patch", "apply_unified_diff"]
# Server (openworker-server) bind address.
host = "127.0.0.1"
port = 8765