[PR #261] [MERGED] feat: add TERMINAL_TOOL_TIMEOUT configuration #275

Closed
opened 2026-06-06 22:10:00 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/261
Author: @mason5052
Created: 4/15/2026
Status: Merged
Merged: 4/21/2026
Merged by: @asdek

Base: feature/next-releaseHead: codex/issue-256-terminal-timeout


📝 Commits (2)

  • 86d7666 feat: add configurable terminal tool timeout
  • 1d6da34 fix: clamp oversized terminal timeout

📊 Changes

16 files changed (+213 additions, -30 deletions)

View changed files

📝 .env.example (+4 -0)
📝 README.md (+1 -0)
📝 backend/cmd/ftester/mocks/tools.go (+1 -1)
📝 backend/cmd/ftester/worker/executor.go (+3 -0)
📝 backend/cmd/installer/wizard/controller/controller.go (+6 -0)
📝 backend/cmd/installer/wizard/locale/locale.go (+14 -2)
📝 backend/cmd/installer/wizard/models/server_settings_form.go (+26 -0)
📝 backend/docs/config.md (+17 -0)
📝 backend/pkg/config/config.go (+1 -0)
📝 backend/pkg/config/config_test.go (+26 -1)
📝 backend/pkg/tools/args.go (+1 -1)
📝 backend/pkg/tools/registry.go (+3 -2)
📝 backend/pkg/tools/terminal.go (+50 -23)
📝 backend/pkg/tools/terminal_test.go (+51 -0)
📝 backend/pkg/tools/tools.go (+8 -0)
📝 docker-compose.yml (+1 -0)

📄 Description

Summary

  • add TERMINAL_TOOL_TIMEOUT as a configurable environment variable with Docker Compose, config, installer, and docs support
  • use the configured timeout as the terminal tool default when a tool call sets timeout=0
  • add unit coverage for config parsing and terminal timeout normalization

Problem

Issue #256 reports that long-running terminal commands can time out with no operator-side configuration to change the default behavior.

At the moment, terminal execution falls back to a hardcoded default timeout in the backend. Users running PentAGI through Docker Compose can adjust HTTP_CLIENT_TIMEOUT, but there is no equivalent setting for terminal tool execution.

Solution

Add a new TERMINAL_TOOL_TIMEOUT setting and thread it through the relevant execution paths.

  • backend/pkg/config parses TERMINAL_TOOL_TIMEOUT with a default of 600
  • docker-compose.yml and .env.example expose the variable for Compose-based deployments
  • terminal tool constructors now receive the configured default timeout and apply it when a tool call uses timeout=0
  • 0 is supported as "no server-side default timeout"
  • installer server settings now expose the same variable
  • docs and tool descriptions were updated so the behavior is visible to users and agents

This keeps explicit tool timeouts intact while giving operators a configuration-level fallback for long-running commands.

User Impact

Operators can now increase the default terminal execution window for long-running commands without patching the codebase. Compose users can set TERMINAL_TOOL_TIMEOUT in .env, and installer users can change the same setting from the server settings flow.

Closes #256.

Test Plan

  • go test ./pkg/config ./pkg/tools/...
  • go test ./cmd/ftester/... ./cmd/installer/wizard/controller ./cmd/installer/wizard/models ./cmd/installer/wizard/locale
  • gofmt -w on changed Go files
  • git diff --check

Notes

go test ./cmd/installer/wizard/... still hits pre-existing Windows host issues in cmd/installer/wizard/terminal because that package expects POSIX commands such as echo, sh, and cat to be available in PATH. This PR does not modify that package.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vxcontrol/pentagi/pull/261 **Author:** [@mason5052](https://github.com/mason5052) **Created:** 4/15/2026 **Status:** ✅ Merged **Merged:** 4/21/2026 **Merged by:** [@asdek](https://github.com/asdek) **Base:** `feature/next-release` ← **Head:** `codex/issue-256-terminal-timeout` --- ### 📝 Commits (2) - [`86d7666`](https://github.com/vxcontrol/pentagi/commit/86d7666c8681ec513d68f4568f332d7e7dc891e7) feat: add configurable terminal tool timeout - [`1d6da34`](https://github.com/vxcontrol/pentagi/commit/1d6da349d41a066fbfdb9cc6368cfb5d281d4d33) fix: clamp oversized terminal timeout ### 📊 Changes **16 files changed** (+213 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+4 -0) 📝 `README.md` (+1 -0) 📝 `backend/cmd/ftester/mocks/tools.go` (+1 -1) 📝 `backend/cmd/ftester/worker/executor.go` (+3 -0) 📝 `backend/cmd/installer/wizard/controller/controller.go` (+6 -0) 📝 `backend/cmd/installer/wizard/locale/locale.go` (+14 -2) 📝 `backend/cmd/installer/wizard/models/server_settings_form.go` (+26 -0) 📝 `backend/docs/config.md` (+17 -0) 📝 `backend/pkg/config/config.go` (+1 -0) 📝 `backend/pkg/config/config_test.go` (+26 -1) 📝 `backend/pkg/tools/args.go` (+1 -1) 📝 `backend/pkg/tools/registry.go` (+3 -2) 📝 `backend/pkg/tools/terminal.go` (+50 -23) 📝 `backend/pkg/tools/terminal_test.go` (+51 -0) 📝 `backend/pkg/tools/tools.go` (+8 -0) 📝 `docker-compose.yml` (+1 -0) </details> ### 📄 Description ## Summary - add `TERMINAL_TOOL_TIMEOUT` as a configurable environment variable with Docker Compose, config, installer, and docs support - use the configured timeout as the terminal tool default when a tool call sets `timeout=0` - add unit coverage for config parsing and terminal timeout normalization ## Problem Issue #256 reports that long-running terminal commands can time out with no operator-side configuration to change the default behavior. At the moment, terminal execution falls back to a hardcoded default timeout in the backend. Users running PentAGI through Docker Compose can adjust `HTTP_CLIENT_TIMEOUT`, but there is no equivalent setting for terminal tool execution. ## Solution Add a new `TERMINAL_TOOL_TIMEOUT` setting and thread it through the relevant execution paths. - `backend/pkg/config` parses `TERMINAL_TOOL_TIMEOUT` with a default of `600` - `docker-compose.yml` and `.env.example` expose the variable for Compose-based deployments - terminal tool constructors now receive the configured default timeout and apply it when a tool call uses `timeout=0` - `0` is supported as "no server-side default timeout" - installer server settings now expose the same variable - docs and tool descriptions were updated so the behavior is visible to users and agents This keeps explicit tool timeouts intact while giving operators a configuration-level fallback for long-running commands. ## User Impact Operators can now increase the default terminal execution window for long-running commands without patching the codebase. Compose users can set `TERMINAL_TOOL_TIMEOUT` in `.env`, and installer users can change the same setting from the server settings flow. Closes #256. ## Test Plan - [x] `go test ./pkg/config ./pkg/tools/...` - [x] `go test ./cmd/ftester/... ./cmd/installer/wizard/controller ./cmd/installer/wizard/models ./cmd/installer/wizard/locale` - [x] `gofmt -w` on changed Go files - [x] `git diff --check` ## Notes `go test ./cmd/installer/wizard/...` still hits pre-existing Windows host issues in `cmd/installer/wizard/terminal` because that package expects POSIX commands such as `echo`, `sh`, and `cat` to be available in `PATH`. This PR does not modify that package. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-06 22:10:00 -04:00
yindo closed this issue 2026-06-06 22:10:00 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#275