Skip to content

feat(observe): report turn-setup phases through TurnObservation::Setup - #718

Merged
senamakel merged 5 commits into
epic/712-tool-tokensfrom
epic-712-713-setup-phases
Nov 8, 2026
Merged

senamakel merged 5 commits into
epic/712-tool-tokensfrom
epic-712-713-setup-phases

Conversation

@senamakel

Copy link
Copy Markdown
Owner

Closes #713
Part of tinyhumansai/chottu-core#712

What changed

  • Bumps vendor/tinyagents to the senamakel/tinyagents epic tip (bdf8f4b7), which brings in TurnObservation::Setup, SetupPhase and report_setup (tinyagents#205) beside ReasoningReplay ([tinyagents-slim] relocate: parent-context builder to triage/ #203) and prune_retired_tools ([tinyagents-slim] relocate: harness/fork_context.rs into subagent_host/ #204). The bump compiles cleanly.
  • New agent::session_host::setup_report::reported, which times a future and calls report_setup (a no-op without a scoped observer).
  • Call sites, in the order a cold turn runs them:
    • AgentOpen around build_turn_agent in agent_chat/session_turn.rs.
    • TranscriptResume around runtime.resume in runtime_session_turn.rs.
    • PromptRefresh around the prompt render (cold_prompt_prefix, which both the cold start and refresh-on-resume use).
    • MemoryBlock around block_for_generation: Skipped when the deadline lapsed, Failed when the read failed, else Completed.
  • openhuman_embed::observe re-exports SetupPhase and SetupOutcome; OBSERVERS.md describes the new observation.
  • A step the turn did not need (no resume on an unthreaded turn, no refresh for a kept prompt, no block for an agent without memory_block) reports nothing. I did not add separate tool-snapshot or prewarm phases: the snapshot is a synchronous in-memory build, and prewarm_memory_block runs outside any turn, so no observer scope exists to report to.
  • Fixed the one exhaustive TurnObservation match in tests/observed_turns.rs (a Setup arm).

Tests

  • setup_phases_are_reported_in_order (crates/openhuman-embed/tests/setup_phases.rs): a cold thread-bound turn reports agent_open, transcript_resume, prompt_refresh, memory_block, then the first Model event. Failed against the unwired code (only model), passes now.
  • setup_report unit tests: outcomes, elapsed time and the unscoped no-op.
  • This test needs a runtime. Locally the runtime fails with "could not admit the secrets directory" because macOS TMPDIR is under the symlinked /var/folders. Running with TMPDIR set to a real path (no symlink) makes it pass, so it ran locally; the pre-existing memory_block embed test passes the same way.

Gates (vendor/openhuman)

  • cargo fmt --all -- --check: pass
  • cargo clippy -p openhuman -p openhuman-embed --lib -- -D warnings: pass
  • cargo clippy -p openhuman-embed --all-targets -- -D warnings: pass (core --all-targets has 23 pre-existing test lints, not run)
  • cargo test -p openhuman --lib setup_report 2/2, memory_block 39/39, runtime_session_turn: no matches; prompt_refresh 13/15
  • cargo test -p openhuman-embed --test setup_phases and --test memory_block: pass

Pre-existing failures (also fail on the epic base)

  • prompt_refresh::resume_refreshes_the_prompt_without_an_integrations_backend and a_resumed_thread_takes_up_the_current_prompt_only_when_its_agent_opts_in hang.
  • agent_chat_for_rejects_an_unknown_agent_id and observed_turns fail with "Prompt flagged for security review" from the prompt guard before any setup phase runs.

senamakel and others added 5 commits November 8, 2026 03:08
…rvation::Setup

Co-authored-by: Medulla <medulla@tinyhumans.ai>
Agent open, transcript resume, prompt refresh and the memory block each
report their duration and outcome to the turn's observer before the first
model request. A memory block that missed its deadline is Skipped and a
failed read is Failed. SetupPhase and SetupOutcome are re-exported from
openhuman_embed::observe.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
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