aft icon indicating copy to clipboard operation
aft copied to clipboard

bash: missing `timeout` argument falls back to a 100 ms default (commands killed instantly)

Open grodingo opened this issue 1 month ago • 2 comments

Summary

When the bash tool is called without an explicit timeout argument, AFT kills the command after 100 ms and reports it as a timeout the caller "passed". Any command slower than a fraction of a second (sleep 0.5, bun scripts/…) is unusable with the default call shape.

Environment

  • @cortexkit/aft-pi 0.63.4, @cortexkit/aft-linux-x64 0.63.4
  • Linux 6.18.56-ogc1.1.fc44.x86_64 (Fedora 44 / Bazzite), x86_64
  • Host: pi-coding-agent 1.4.0, bun 1.4.2
  • ~/.config/cortexkit/aft.jsonc: indexes.*, bash.{compress,rewrite,background}, github.read, disabled_tools — no timeout key

Reproduction

  1. Call the bash tool with no timeout:
{ "command": "sleep 0.5; echo SURVIVED" }
  1. Observed (exit 124):
[command timed out] killed by the `timeout` of 0.1s you passed (exit 124)
  1. Controls:
    • same command with "timeout": 60000 → succeeds
    • "timeout": 1 → killed by the timeout of 0s you passed (exit 124) — so the argument unit is milliseconds (1 ms ≈ 0 s), and the default 0.1 s = 100 ms.

Why this is AFT's default, not the host's

  • The message string exists only in the native binary: strings @cortexkit/aft-linux-x64/bin/aft → killed by the `timeout` of … you passed (exit 124).
  • The host has its own default and its own message: BASH_DEFAULT_TIMEOUT_MS = 120000 with bash command timed out after ${ms}ms — neither matches.
  • The tool-call arguments recorded by the host for the failing call contain no timeout key ({"command": …, "description": …}), so 100 ms was not injected by the caller.
  • The published schema (assets/aft.schema.json) exposes no bash section and no timeout property; the config resolver strings list only bash.rewrite, bash.compress, bash.background.

Expected

  • A sane foreground default (e.g. 120 s, in line with common host defaults), or
  • a configurable bash.timeout_ms (clamped) so the default can be raised once instead of at every call site.

Suspected cause

Unit slip: 0.1 looks like a value in seconds reused as (and printed as) seconds while the tool's public argument is milliseconds — i.e. a default of 100 ms instead of ≥ 1000 ms. The wording "you passed" is also misleading when the caller passed nothing.

Workaround

Pass an explicit timeout (ms) on every bash call.

grodingo avatar Oct 31 '26 23:10 grodingo

Thanks @grodingo for the detailed report and workaround.

I tried a clean Linux installation with Bun 1.4.2, @earendil-works/pi-coding-agent 1.4.0, and the published @cortexkit/aft-pi / @cortexkit/aft-linux-x64 0.63.4 packages. I haven't reproduced the 100 ms timeout: sleep 0.5; echo SURVIVED, with a description but no timeout, completed successfully. I checked print and RPC modes, worker sessions, and both settings for bash background execution, rewriting, compression, and subagent background execution. The captured arguments contained no timeout when entering the plugin or leaving it for AFT.

Could you share:

  • Your full aft.jsonc, with secrets removed, including any project-level overrides.
  • The list of installed Pi extensions.
  • The exact Pi package name and version.
  • The AFT plugin log lines for one failing call, with sensitive command contents removed.

That should help us locate where the 100 ms value enters without guessing at a fix. In the meantime, passing an explicit timeout in milliseconds, such as 60000, remains the workaround.

aft-alfonso[bot] avatar Nov 01 '26 09:11 aft-alfonso[bot]

We have not reproduced the 100 ms timeout. In 0.64.0 an omitted timeout follows the 30-minute native default, and long progressing shell calls are no longer cut by runner silence handling; neither establishes what caused your result. Could you share your redacted user and project configuration, installed Pi extensions, exact Pi package/version, exact failing call, and AFT's log line for that call? Those should let us see where the effective timeout enters. An explicit timeout in milliseconds remains a workaround.

aft-alfonso[bot] avatar Nov 11 '26 19:11 aft-alfonso[bot]