Skip to content

fix(host,cli): handle final_answer turns, approval timeouts, and input keys (ENG-405) - #8

Merged
folathecoder merged 2 commits into
mainfrom
folathecoder/eng-405-81-pre-release-fixes-final_answer-handling-approval-timeouts
Oct 18, 2026
Merged

folathecoder merged 2 commits into
mainfrom
folathecoder/eng-405-81-pre-release-fixes-final_answer-handling-approval-timeouts

Conversation

@folathecoder

Copy link
Copy Markdown
Contributor

Summary

Fixes the nine issues identified during the Aldwin 0.0.1 pre-release audit and end-to-end PTY review so ENG-385 (Release Aldwin 0.0.1) can begin cleanly. Turns that finish via Agentling's built-in final_answer tool now render their full Markdown answer without showing an internal final_answer tool card, approval prompts wait indefinitely without being cancelled at 60 seconds by Agent.tool_timeout, long tool rows unwrap JSON before truncation and keep duration · summary visible at 80 columns, and \+Enter and Ctrl+J insert newlines.

Ticket

Closes ENG-405

Changes

  • Host (src/aldwin/host/runner.py):
    • Suppress final_answer from ToolCallEvent and non-error ToolResultEvent in AldwinHost._run_turn, and emit TextEvent from final_answer when the final step did not stream TextDelta chunks (FR-1).
    • Unwrap primary string fields (command, url, name, query, text) in format_args_preview before truncating at 120 characters (FR-3).
  • Core tools (src/aldwin/core/tools/run_command.py, src/aldwin/core/tools/persona_tool.py):
    • Set timeout: float | None = float("inf") on RunCommandTool and SetPersonaTool so Agent.tool_timeout (60.0 s) does not cancel ask() while waiting for user approval, leaving RunCommandTool's post-approval 60-second timer in control (FR-2).
  • CLI (src/aldwin/cli/):
    • Cap display_args width in TurnRenderer.on_tool_result so duration · summary is never clipped on 80-column terminals, and add a truncated-JSON fallback in format_display_args (FR-3, FR-4).
    • Bind Ctrl+J (c-j) and \+Enter (c-m) to insert newlines in build_prompt_session and update /help keybindings (FR-5).
    • Validate OPENAI_API_KEY from os.environ on first run via needs_onboarding / run_onboarding (FR-6).
    • Add PLAIN_PROMPT_STYLE (noreverse on bottom-toolbar) for --plain and NO_COLOR=1 (FR-7).
    • Remove (FR-1) from setup and uninstall --help docstrings, cap display_home in the session header Panel title so panels stay <= 76 columns, italicize continue in colour-mode notices, and remove unused short_session_id (FR-8).
  • Tests (tests/):
    • Added 13 unit and integration regression tests (TC-01 to TC-15) across test_host_runner.py, integration/test_full_turns.py, test_run_command.py, test_persona.py, test_cli_render.py, cli/test_render_suite.py, test_cli_chat.py, test_cli_onboarding.py, and test_cli_main.py.

How it was tested

  • Automated:
    • uv run ruff check src tests (passed)
    • uv run ruff format --check src tests (69 files formatted)
    • uv run mypy src tests (0 issues in 65 source files)
    • uv run pytest --cov=aldwin --cov-report=term-missing --cov-fail-under=90 (246 passed, 2 deselected in 4.19s, 92.49% coverage)
  • Manual / PTY (TC-16):
    • Built wheel with uv build, installed into an isolated UV_TOOL_DIR, and verified aldwin --help, 80-column long tool rows, final_answer Markdown rendering, \+Enter and Ctrl+J multi-line input, and --plain mode (0 reverse-video SGR codes).

Notes for reviewers

  • Agent.tool_timeout remains 60.0 for non-approval tools (ENG-380 FR-1), while RunCommandTool and SetPersonaTool opt out of the pre-approval wrapper via timeout = float("inf").

Folarin Akinloye added 2 commits October 18, 2026 23:10
…t keys (ENG-405)

Suppress Agentling's internal final_answer tool from protocol tool cards and emit its answer as a TextEvent when no TextDelta chunks were streamed. Set timeout=inf on RunCommandTool and SetPersonaTool so Agent.tool_timeout does not expire while waiting on user approval. Unwrap tool arguments before 120-char truncation, preserve tool result summaries on 80-column terminals, bind Ctrl+J and \+Enter to insert newlines, validate OPENAI_API_KEY from the environment on first run, and disable reverse-video toolbars in plain mode.
@folathecoder
folathecoder merged commit d1b2117 into main Oct 18, 2026
4 checks passed
@folathecoder
folathecoder deleted the folathecoder/eng-405-81-pre-release-fixes-final_answer-handling-approval-timeouts branch October 18, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant