Skip to content

Misc parity cleanups & doc drift from the tinyagents migration #4469

Description

@senamakel

Part of the v0.58.7 → HEAD TinyAgents-migration audit (see parent issue). Low-severity parity items, dead code, and doc drift — batchable.

Behavior nits

  1. Stop-hook "hard stop" is soft: StopHookMiddleware pauses via SteeringCommand::Pause (src/openhuman/agent/stop_hooks.rs:144), drained only at the next iteration top — the current tool round (possibly expensive spawns) still executes, then summarize_turn_wrapup spends one more model call. Contradicts GoalBudgetStopHook's "hard-stops the moment usage would exceed the cap" doc (session/turn/core.rs:696-706). Either enforce immediately (skip pending tool round on Stop) or fix the docs and cap the wrap-up.
  2. TextModeProvider passthroughs missing (ops/runner.rs:1157-1212): doesn't forward is_local_provider/is_local_provider_for_model/loaded_context_window/prompt_cache_capabilities — a local provider behind text-mode loses the n_keep >= n_ctx guards and is profiled as remote (tinyagents/model.rs:347). Forward the methods.
  3. Poisoned-mutex panics on error recovery: .lock().unwrap() on error_slot (tinyagents/mod.rs:614) and EarlyExitHook slots (tinyagents/tools.rs:49/57) — use unwrap_or_else(PoisonError::into_inner).
  4. max_iterations == 0 now normalizes to 10 (legacy clamped to 1) — confirm intended, document.
  5. Cap-summary output cap pinned to AGENT_TURN_MAX_OUTPUT_TOKENS instead of the definition's budget (ops/graph.rs:318).
  6. Aggregate tool-result spill can blank a result to "" with no artifact pointer (harness/tool_result_artifacts/mod.rs:343,365,386,400-403): allowed_len saturates to 0 → bound_text_to_budget(_, 0) returns "", discarding the [tool_result_preview] envelope with artifact_path; small allowed_len can truncate the envelope mid-header. Enforce a minimum envelope allowance.
  7. Mid-turn Composio/tool-surface resync dropped (now turn-boundary only, session/turn/core.rs:268) and LazyToolkitResolver stubbed (ops/runner.rs:904, "Improve agent harness with LangGraph-style state machine or Polaris-like architecture #4249 1b") — track restoration or explicitly descope.

Dead code / doc drift

  1. rolling_segment_recap (harness/archivist/recap.rs:206): ~100-line public method, zero callers since the migration; doc describes a deleted caller architecture. Remove or re-wire.
  2. Unreachable "falling back to inline truncation" branch (tool_result_artifacts/mod.rs:266-274) logs a fallback but returns the envelope anyway.
  3. Stale model_vision_context references: session/types.rs:56, builder/setters.rs:147, turn_attachments_context.rs:15 + 2 more cite the deleted task-local; the replacement gate (session/turn/core.rs:843) inverts the documented legacy guard — appears intentional (managed backend routes via hint:reasoning) but the docs are wrong.
  4. agent/README.md:12 still lists deleted harness/interrupt.rs.
  5. Payload-summarizer doc comment says 500 000 default; config default is 4 000 (unchanged old→new — doc was always wrong; fix while here).
  6. Local Langfuse NDJSON envelope not actually Langfuse-ingestible (missing id/timestamp, snake_case body) contrary to its doc (progress_tracing.rs:718-739).
  7. Dead-at-base deletions confirmed clean, for the record: interrupt.rs, session_queue.rs, self_healing.rs, tree_loader.rs, memory_loader.rs facade — no action needed.

Acceptance criteria

  • Each numbered item either fixed or explicitly descoped with a comment/doc note; no comment left asserting behavior the code doesn't have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentBuilt-in agents, prompts, orchestration, and agent runtime in src/openhuman/agent/.maintenanceMaintenance work, dependency updates, or cleanup.priority: lowSingle occurrence or nichesubtaskSubtask of a larger tracked effort.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions