Skip to content

feat(openab-agent): OPENAB_AGENT_LOG_FILE + richer tool tracing#7

Open
Joseph19820124 wants to merge 1 commit into
mainfrom
feat/agent-log-file
Open

feat(openab-agent): OPENAB_AGENT_LOG_FILE + richer tool tracing#7
Joseph19820124 wants to merge 1 commit into
mainfrom
feat/agent-log-file

Conversation

@Joseph19820124
Copy link
Copy Markdown
Owner

What

Adds an env-driven file log sink and richer tool tracing to openab-agent.

Extracted as a standalone, provider-agnostic PR from the parallel feat/gemini-provider branch, which had bundled it together with the Gemini provider. It depends on neither the Gemini provider (#6) nor the skills (#5) work.

Why

When openab spawns the agent subprocess it swallows the child's stderr, hiding the existing info!("executing tool: …") traces. This adds a way for the agent to persist its own log, and expands each tool turn so the log is actually useful for debugging.

Changes

  • main.rs — when OPENAB_AGENT_LOG_FILE is set, initialize tracing-subscriber with a Mutex<File> writer in append mode (ANSI off). Falls back to stderr when unset, with a clear error message if the file can't be opened.
  • agent.rs — log both the pre-call (tool call: NAME input=…) and post-call (tool result: NAME ok bytes=N preview=… / error=…) lines, via a char-safe preview() truncation helper that also collapses newlines.

Scope & checks

base = upstream-main; diff is exactly 2 files (main.rs, agent.rs, +52/-5). No new env vars beyond OPENAB_AGENT_LOG_FILE, no behavior change when it's unset.

  • cargo build, cargo test (19 passed / 0 failed), cargo fmt --check — clean.

Original work by @Joseph19820124 (commit cherry-picked; the _sig tuple element from that branch's Gemini changes was dropped here so the commit stands alone on upstream-main).

🤖 Generated with Claude Code

@github-actions github-actions Bot added pending-screening PR awaiting automated screening closing-soon labels May 31, 2026
@Joseph19820124 Joseph19820124 added the enhancement New feature or request label May 31, 2026
@github-actions
Copy link
Copy Markdown

⚠️ This PR is missing a Discord Discussion URL in the body.

All PRs must reference a prior Discord discussion to ensure community alignment before implementation.

Please edit the PR description to include a link like:

Discord Discussion URL: https://discord.com/channels/...

This PR will be automatically closed in 3 days if the link is not added.

openab swallows the agent subprocess's stderr, hiding the existing
`info!("executing tool: ...")` trace. Add an env-driven file sink so
the agent can persist its own log when run under openab, and expand
each tool turn to capture name + input preview + result size/preview.

- `main.rs`: when `OPENAB_AGENT_LOG_FILE` is set, init
  tracing-subscriber with `Mutex<File>` writer in append mode
  (ANSI off). Falls back to stderr when unset, with a clear error
  message if the file can't be opened.
- `agent.rs`: log both `tool call: NAME input=...` (pre) and
  `tool result: NAME ok bytes=N preview=...` (post), with a
  char-safe truncation helper that also collapses newlines.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Joseph19820124 Joseph19820124 changed the base branch from upstream-main to main May 31, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending-maintainer pending-screening PR awaiting automated screening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant