Skip to content

Fix missing imports in sync-openai-agents template#278

Open
muhammad-rifky-scale wants to merge 1 commit into
mainfrom
mr/fix-sync-openai-agents-template-imports
Open

Fix missing imports in sync-openai-agents template#278
muhammad-rifky-scale wants to merge 1 commit into
mainfrom
mr/fix-sync-openai-agents-template-imports

Conversation

@muhammad-rifky-scale

@muhammad-rifky-scale muhammad-rifky-scale commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add StreamTaskMessageFull to the TaskMessageUpdate import in acp.py.j2
  • Add missing TextContent import from agentex.types.text_content

Context

The issue was discovered when running agentex init and selecting the Sync ACP + OpenAI Agents SDK template. The generated acp.py was missing two imports, causing runtime errors immediately after project initialization when OPENAI_API_KEY is not present.

Test plan

  • Ran agentex init, selected Sync ACPSync ACP + OpenAI Agents SDK, and verified the generated project contains the correct imports without errors

Greptile Summary

Fixes two missing imports in the sync-openai-agents Jinja2 template that caused immediate NameError at runtime when using agentex init with the Sync ACP + OpenAI Agents SDK option.

  • Adds StreamTaskMessageFull to the import from agentex.types.task_message_update (used on line 79 for the missing-API-key guard)
  • Adds TextContent import from agentex.types.text_content (used on line 82 to construct the error message content)
  • Both symbols are verified exports from their respective modules; no other templates are affected

Confidence Score: 5/5

  • This PR is safe to merge — it only adds two missing imports that fix a runtime NameError.
  • The change is minimal (2 lines added), purely additive (import statements only), fixes a clear runtime bug, and both imported symbols are verified exports from their source modules. No logic changes, no risk of regression.
  • No files require special attention.

Important Files Changed

Filename Overview
src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 Adds two missing imports (StreamTaskMessageFull, TextContent) that are used on lines 79 and 82 respectively. Both symbols are verified exports from their source modules. No issues found.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["agentex init (Sync ACP + OpenAI Agents)"] --> B["Generates acp.py from acp.py.j2"]
    B --> C{"OPENAI_API_KEY set?"}
    C -- No --> D["yield StreamTaskMessageFull\nwith TextContent error message"]
    C -- Yes --> E["Run OpenAI Agent via Runner.run_streamed"]
    E --> F["convert_openai_to_agentex_events"]
    F --> G["yield agentex streaming events"]
    G --> H["Update task state via adk.state.update"]

    style D fill:#f9d71c,stroke:#333
Loading

Last reviewed commit: 0d2c5f0

Add StreamTaskMessageFull and TextContent imports to acp.py.j2
so the no-API-key error response compiles correctly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@muhammad-rifky-scale muhammad-rifky-scale marked this pull request as draft February 27, 2026 17:49
@muhammad-rifky-scale muhammad-rifky-scale marked this pull request as ready for review February 27, 2026 17:50
max-parke-scale added a commit that referenced this pull request Jun 17, 2026
Generalizes the #405 regression guard. Captures the requests the ADK emits
(states.create/update for v1) and validates each against a window of supported
server OpenAPI contracts vendored under tests/compat/server_specs/: `current`
(scale-agentex main) and `min-supported` (pre-#278, which still requires
task_id/agent_id in the state body).

Catches the 0.13.0 class of break — a client that drops a field an older
deployed server still requires. Verified: with the field-drop, states.update
fails "task_id/agent_id required" against min-supported while passing current.

Specs are vendored for deterministic CI (no network); refresh_specs.py re-pulls
them at the SHAs in manifest.json. Advance min-supported as the oldest deployed
server moves forward; extend _OPERATIONS for more ADK operations.

Stacked on #405 (needs the extra_body fix so states.update passes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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