From 5c7b278d4047f974bd572d53f3d032bf98d4daf0 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Sun, 10 May 2026 15:24:19 +0300 Subject: [PATCH] Assert loaded skill input injection Create a repo skill inside the app-server harness workspace and assert that SkillInput resolves to an injected skill block at the model request boundary. Co-authored-by: Codex --- sdk/python/tests/test_app_server_inputs.py | 54 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/sdk/python/tests/test_app_server_inputs.py b/sdk/python/tests/test_app_server_inputs.py index dbd4afd4e0..5e560062e5 100644 --- a/sdk/python/tests/test_app_server_inputs.py +++ b/sdk/python/tests/test_app_server_inputs.py @@ -1,7 +1,7 @@ from __future__ import annotations from app_server_harness import AppServerHarness -from openai_codex import Codex, ImageInput, LocalImageInput, TextInput +from openai_codex import Codex, ImageInput, LocalImageInput, SkillInput, TextInput from app_server_helpers import TINY_PNG_BYTES @@ -72,3 +72,55 @@ def test_local_image_input_reaches_responses_api( "contains_user_prompt": True, "image_url_is_png_data_url": True, } + + +def test_skill_input_injects_loaded_skill_body(tmp_path) -> None: + """SkillInput should inject the selected loaded skill into model input.""" + skill_body = "Use the word cobalt." + + with AppServerHarness(tmp_path) as harness: + skill_file = harness.workspace / ".agents" / "skills" / "demo" / "SKILL.md" + skill_file.parent.mkdir(parents=True) + skill_file.write_text( + f"---\nname: demo\ndescription: demo skill\n---\n\n{skill_body}\n" + ) + skill_path = skill_file.resolve() + harness.responses.enqueue_assistant_message( + "skill received", + response_id="skill-input", + ) + + with Codex(config=harness.app_server_config()) as codex: + result = codex.thread_start().run( + [ + TextInput("Use the selected skill."), + SkillInput("demo", str(skill_path)), + ] + ) + request = harness.responses.single_request() + + skill_blocks = [ + text + for text in request.message_input_texts("user") + if text.startswith("") + ] + assert { + "final_response": result.final_response, + "skill_blocks": [ + { + "has_name": "demo" in text, + "has_path": f"{skill_path}" in text, + "has_body": skill_body in text, + } + for text in skill_blocks + ], + } == { + "final_response": "skill received", + "skill_blocks": [ + { + "has_name": True, + "has_path": True, + "has_body": True, + } + ], + }