Repository navigation
feat(embed): let an embedder set the turn's close copy - #704
Merged
Merged
Conversation
Close and final-summary copy now comes from a CloseCopy carried on the run context instead of a fixed constant, so embedders can supply their own wording. Added product_copy helpers and embed builder defaults, plus tests covering custom and default close copy. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Refresh Cargo.lock to pick up the reworked tinytools, tinywallet, and tinybox dependency graph, and extend the close-copy tests to cover the updated embed behaviour. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…s to it The host policy now carries the resolved CloseCopy, read through OpenHumanRunContext::close_copy(), so the middleware and grounded-close paths cannot drift on the default. A new embed test drives a four-call capped turn and asserts the penultimate request carries the copy's final_write_instruction and the last one its max_iteration_instruction, for the runtime copy and the per-turn override. Co-authored-by: Medulla <medulla@tinyhumans.ai>
…e echo repair Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted the assertions and turn construction in the wrap-up close copy test to satisfy rustfmt line-length limits. No test behaviour or coverage changed. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Lets an embedder set the wording a turn is closed with when it stops at its tool-call cap or ends without a reply (
CloseCopy: the model's cap instruction, the final-write instruction, the deterministic fallbacks and the repair prompts).RuntimeBuilder::close_copy(CloseCopy)sets it per runtime;Turn::close_copy(CloseCopy)overrides it for one turn.CloseCopyandENGLISH_CLOSE_COPYare re-exported fromopenhuman-embed.HostTurnEnv/OpenHumanRunContext(inherited by children) and read in one place,OpenHumanRunContext::close_copy(), which bothcontext_wiring(FinalCallWrapUpMiddleware) andgrounded_close/executenow take instead of the hard-wiredOPENHUMAN_CLOSE_COPY. The two paths cannot drift apart.product_copy::close_needlesadds the instructions actually in force to the needle list, so the echo-strip still removes a reworded instruction the model repeats;is_final_summaryrecognises the copy's own "finished without a result" opening instead of a hard-coded English sentence.The default stays
ENGLISH_CLOSE_COPY, so OpenHuman's own behaviour is unchanged.Cause: the close copy was a process-wide constant, so a host whose turns are chat replies to end users could not stop a capped turn from being told to write an operator report.
Closes #702
Part of tinyhumansai/chottu-core#537
Tests
an_embedder_close_copy_reaches_the_capped_turn(runtime copy and per-turn override reach the model and the checkpoint reply),the_default_close_copy_is_unchanged(openhuman-embed/tests/close_copy*.rs)a_reworded_close_instruction_echoed_by_the_model_is_recognisedand relatedproduct_copytests (core)Gates and caveats
fork/epic/537-turn-qualitydoes not compileopenhuman-coreon its own (21 errors, from the merged tinyhumansai#8487 state: e.g.secure_openpath,awaitin non-async fn), so the gates were run on a throwaway local branch = this branch +fork/pr-8487-followup(not pushed):cargo test -p openhuman-embed --features inference,mcp,skills --test close_copy --test close_copy_default: pass, but only with the prompt screen bypassed locally. The security module artifact is not installed in this sandbox, so the screen holds every prompt; sibling embed turn tests (agent_lifecycle,observed_turns) fail identically here with the screen intact. Needs a CI run with the module fixture.cargo test -p openhuman --lib -- agent::session_host::product_copy agent::session_host::driver::grounded_close agent::tinyagents::context: 50 pass, 2 fail (the_final_summary_of_a_halted_turn_gives_a_reason_and_names_the_tools,classified_halt_returns_partial_work_without_provider_usage); both assert on tool error text that arrives as[REDACTED]from the followup state and go through code this PR does not touch.cargo clippy -p openhuman -p openhuman-embed --all-targets -- -D warnings: no diagnostics in files changed here (existing unused-import errors elsewhere).cargo fmt -- --check: clean.Review round 1 follow-up
wrap_up_close_copy, max_iterations >= 3): the penultimate request carries the customfinal_write_instruction, the last permitted one the custommax_iteration_instruction, no English default.close_needlesnow includesstop_note_preamble; grounded_close test pins the echo repair with a reworded copy.OpenHumanRunContext::close_copy().Turnrather thanTurnRequeston purpose:TurnRequestis the serializedinference.agent_chatwire contract and cannot carry copy.the_final_summary_of_a_halted_turn...,classified_halt_returns_partial_work...) fail identically on the base. The branch carries no bypass and net-zero submodule/Cargo.lock change.