Skip to content

Track Codex native Responses sessions and reload skills after evolve#45

Merged
StoneHanaMori merged 7 commits into
mainfrom
pr/codex-responses-skill-reload
May 27, 2026
Merged

Track Codex native Responses sessions and reload skills after evolve#45
StoneHanaMori merged 7 commits into
mainfrom
pr/codex-responses-skill-reload

Conversation

@StoneHanaMori
Copy link
Copy Markdown
Collaborator

Summary

  • Track Codex sessions on the native Responses API path so session snapshots, skill injection, and evolve triggers work end-to-end for Codex users (the _responses_native_enabled path previously bypassed _handle_request and was invisible to evolve)
  • Reconstruct assistant output from response.output_text and response.output_item events because real Responses streams may omit output from the final response.completed payload
  • Split the Codex profile into ~/.codex/skillclaw.config.toml so the global ~/.codex/config.toml stays free of [profiles.skillclaw] and doesn't interfere with normal Codex runs
  • Trigger session uploads on user turns rather than only on streamed responses
  • After uploading a session snapshot, wait for the evolve trigger response and pull skills from shared storage when uploaded_skills > 0; add an optional callback notify mode on the evolve server for future use
  • Add proxy polling for shared skill reloads as the non-invasive default

Test plan

  • `pytest tests/test_codex_profile_integration.py`
  • `pytest tests/test_evolve_proxy_reload.py`
  • `pytest tests/test_responses_native.py`
  • `pytest tests/test_session_upload_trigger.py`
  • Manual end-to-end: Codex session through proxy -> evolve trigger -> shared skill reload visible in proxy

The native Responses API path (_responses_native_enabled) bypassed
_handle_request entirely, skipping session turn recording, skill
injection tracking, and snapshot uploads. Codex sessions through
the proxy were invisible to the evolve pipeline.

Adds _record_responses_turn to capture prompt/response text and
injected_skills for Responses API requests, enabling the full
session -> evolve -> skill generation loop for Codex users.
Parse native Responses streaming events before forwarding each chunk so session tracking is not lost if the client closes after response.completed.

Reconstruct assistant output from response.output_text and response.output_item events because real Responses streams may omit output from the final response.completed payload.

Update Codex integration to use the current split profile file at ~/.codex/skillclaw.config.toml while keeping ~/.codex/config.toml free of legacy [profiles.skillclaw] tables.
When the proxy uploads a session snapshot and triggers the evolve server, wait for the synchronous trigger response and pull skills from shared storage when the evolve result reports uploaded_skills > 0. This keeps the demo path working without requiring the evolve server to call back into a proxy port that may not be reachable or safe to expose.

Future TODO: replace the long synchronous trigger with an explicit async evolve job API. /trigger should return accepted/job_id, jobs should persist status/heartbeat/timeouts and claim sessions idempotently, and reload notification should prefer proxy polling, Nacos watch/listener, or secured same-network callbacks with token/mTLS/IP allowlist.
@StoneHanaMori StoneHanaMori merged commit 38fa153 into main May 27, 2026
1 check passed
@StoneHanaMori StoneHanaMori deleted the pr/codex-responses-skill-reload branch May 28, 2026 13:58
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