@oneciel-ai/ciel-runtime 0.2.37 → 0.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +5 -2
  3. package/ciel_runtime.py +94 -96
  4. package/ciel_runtime_support/anthropic_model_policy.py +20 -3
  5. package/ciel_runtime_support/architecture.py +5 -0
  6. package/ciel_runtime_support/channel_inflight.py +4 -4
  7. package/ciel_runtime_support/channel_injection.py +56 -1
  8. package/ciel_runtime_support/channel_mcp_tools.py +34 -0
  9. package/ciel_runtime_support/channel_message_policy.py +9 -1
  10. package/ciel_runtime_support/channel_message_prompt.py +23 -0
  11. package/ciel_runtime_support/channel_pending_injection.py +86 -32
  12. package/ciel_runtime_support/channel_pending_poll.py +6 -2
  13. package/ciel_runtime_support/channel_runtime_environment.py +0 -11
  14. package/ciel_runtime_support/channel_terminal_context.py +0 -6
  15. package/ciel_runtime_support/channel_terminal_proxy.py +3 -42
  16. package/ciel_runtime_support/channel_transcript_repository.py +16 -1
  17. package/ciel_runtime_support/channel_wake_claim_repository.py +0 -19
  18. package/ciel_runtime_support/channel_wake_context.py +6 -13
  19. package/ciel_runtime_support/channel_wake_delivery_repository.py +50 -0
  20. package/ciel_runtime_support/chat_http_controller.py +88 -5
  21. package/ciel_runtime_support/claude_environment.py +100 -3
  22. package/ciel_runtime_support/claude_launch_assembly.py +4 -0
  23. package/ciel_runtime_support/claude_session_socket.py +181 -0
  24. package/ciel_runtime_support/cli_application_context.py +18 -10
  25. package/ciel_runtime_support/cli_dispatch.py +19 -3
  26. package/ciel_runtime_support/cli_parser.py +2 -0
  27. package/ciel_runtime_support/cli_usage.py +3 -2
  28. package/ciel_runtime_support/codex_backend_context.py +8 -3
  29. package/ciel_runtime_support/codex_completion_gate.py +198 -0
  30. package/ciel_runtime_support/codex_turn_recovery.py +240 -83
  31. package/ciel_runtime_support/compatibility_protocol.py +5 -2
  32. package/ciel_runtime_support/config_migrations.py +79 -0
  33. package/ciel_runtime_support/config_repository.py +7 -0
  34. package/ciel_runtime_support/context_summary_policy.py +24 -4
  35. package/ciel_runtime_support/external_event_menu.py +107 -0
  36. package/ciel_runtime_support/external_event_receiver.py +19 -1
  37. package/ciel_runtime_support/launch_state.py +2 -0
  38. package/ciel_runtime_support/managed_tool_injection.py +33 -0
  39. package/ciel_runtime_support/muse_runtime_context.py +291 -0
  40. package/ciel_runtime_support/ollama_thinking.py +12 -26
  41. package/ciel_runtime_support/prelaunch.py +13 -0
  42. package/ciel_runtime_support/prelaunch_launch_panel.py +2 -1
  43. package/ciel_runtime_support/prompt_compaction.py +39 -0
  44. package/ciel_runtime_support/provider_files_proxy.py +248 -0
  45. package/ciel_runtime_support/provider_model_identity.py +10 -2
  46. package/ciel_runtime_support/provider_option_cli.py +1 -1
  47. package/ciel_runtime_support/provider_request_access.py +54 -1
  48. package/ciel_runtime_support/provider_responses_passthrough.py +152 -15
  49. package/ciel_runtime_support/providers/alibaba.py +34 -1
  50. package/ciel_runtime_support/providers/anthropic.py +18 -1
  51. package/ciel_runtime_support/providers/meta.py +252 -21
  52. package/ciel_runtime_support/pseudo_tool_parser.py +17 -1
  53. package/ciel_runtime_support/remote_bridge.py +4 -0
  54. package/ciel_runtime_support/remote_instructions.py +5 -0
  55. package/ciel_runtime_support/remote_memory.py +1 -1
  56. package/ciel_runtime_support/responses_cache_diagnostics.py +82 -0
  57. package/ciel_runtime_support/responses_custom_tool_bridge.py +282 -0
  58. package/ciel_runtime_support/responses_input_compatibility.py +19 -3
  59. package/ciel_runtime_support/router_http.py +301 -4
  60. package/ciel_runtime_support/router_observability_context.py +26 -0
  61. package/ciel_runtime_support/router_server_context.py +1 -0
  62. package/ciel_runtime_support/runtime_adapters.py +31 -0
  63. package/ciel_runtime_support/runtime_constants.py +23 -1
  64. package/ciel_runtime_support/runtime_input_gateway.py +85 -5
  65. package/ciel_runtime_support/runtime_input_status.py +150 -0
  66. package/ciel_runtime_support/runtime_launch.py +27 -4
  67. package/ciel_runtime_support/runtime_paths.py +1 -0
  68. package/ciel_runtime_support/speech_http_controller.py +3 -2
  69. package/ciel_runtime_support/streaming_anthropic.py +3 -0
  70. package/ciel_runtime_support/tool_call_events.py +98 -0
  71. package/ciel_runtime_support/transcript_delta_delivery.py +140 -1
  72. package/ciel_runtime_support/ui_text.py +1 -0
  73. package/ciel_runtime_support/web_search_result_events.py +130 -0
  74. package/ciel_runtime_support/web_ui.py +1 -0
  75. package/ciel_runtime_support/windows_conpty.py +92 -8
  76. package/ciel_runtime_support/workspace_mcp.py +4 -1
  77. package/ciel_runtime_support/workspace_state.py +1 -0
  78. package/docs/Configuration.md +20 -4
  79. package/docs/MCP-Channels.md +79 -6
  80. package/docs/Managed-Tool-Injection.md +25 -0
  81. package/docs/Module-Map.md +4 -0
  82. package/docs/Muse-Code.md +73 -0
  83. package/docs/Observability.md +39 -0
  84. package/docs/Providers.md +29 -2
  85. package/docs/Remote-Bridge.md +12 -0
  86. package/docs/Router.md +1 -0
  87. package/docs/journal/2026/09/01/diagnostics/anthropic/router/fable51-usage-credits.okf +70 -0
  88. package/docs/journal/2026/09/01/implementation/claude/session-socket/all-input-paths/default-delivery.okf +133 -0
  89. package/docs/journal/2026/09/01/implementation/claude/session-socket/windows-direct-input.okf +112 -0
  90. package/docs/journal/2026/09/02/diagnostics/cache/alibaba/qwen38-post-restart-hit-rate.okf +107 -0
  91. package/docs/journal/2026/09/02/diagnostics/cache/ollama-cloud/kimi-k3-codex-hit-rate.okf +91 -0
  92. package/docs/journal/2026/09/02/diagnostics/codex/tui/statusline-cache-metrics.okf +44 -0
  93. package/docs/journal/2026/09/02/diagnostics/input/transport/fallback-behavior.okf +31 -0
  94. package/docs/journal/2026/09/02/diagnostics/providers/ollama-cloud/kimi-k3-agent-turn-recovery.okf +125 -0
  95. package/docs/journal/2026/09/02/diagnostics/providers/ollama-cloud/kimi-k3-parameters.okf +128 -0
  96. package/docs/journal/2026/09/02/diagnostics/remote/mia/socket-tui-visibility.okf +47 -0
  97. package/docs/journal/2026/09/02/diagnostics/runtime/alibaba/token-plan/qwen38-latency.okf +108 -0
  98. package/docs/journal/2026/09/02/diagnostics/runtime/alibaba/token-plan/qwen38-vs-gpt56-latency.okf +92 -0
  99. package/docs/journal/2026/09/02/implementation/anthropic/context/one-million-defaults.okf +85 -0
  100. package/docs/journal/2026/09/02/implementation/cache/alibaba/qwen38-cache-hit-improvement.okf +104 -0
  101. package/docs/journal/2026/09/02/implementation/cache/alibaba/qwen38-cache-hit-improvement.png +0 -0
  102. package/docs/journal/2026/09/02/implementation/cache/alibaba/responses-session-cache.okf +97 -0
  103. package/docs/journal/2026/09/02/implementation/providers/alibaba/qwen38/0902-parameter-alignment.okf +97 -0
  104. package/docs/journal/2026/09/02/implementation/providers/meta/multimodal-tools/contributor-protocol-adoption.okf +140 -0
  105. package/docs/journal/2026/09/02/implementation/providers/meta/muse-spark-1.3-support.okf +53 -0
  106. package/docs/journal/2026/09/02/monitoring/cache/alibaba/cielarvis-qwen38-live-hit-rate.okf +858 -0
  107. package/docs/journal/2026/09/02/operations/release/main-merge-local-deploy.okf +36 -0
  108. package/docs/journal/2026/09/02/operations/release/nightly/local-cache-deployment.okf +54 -0
  109. package/docs/journal/2026/09/02/operations/release/nightly/ollama-kimi-recovery-model-audit-deployment.okf +58 -0
  110. package/docs/journal/2026/09/02/operations/release/nightly/qwen38-cache-improvement-deployment.okf +72 -0
  111. package/docs/journal/2026/09/02/research/cache/alibaba/qwen38-hit-rate-improvement.okf +233 -0
  112. package/docs/journal/2026/09/02/research/cache/codex/provider-scope.okf +77 -0
  113. package/docs/journal/2026/09/02/research/providers/ollama-cloud/desktop-model-exhaustive-audit.okf +159 -0
  114. package/docs/journal/2026/09/03/diagnostics/providers/meta/muse-spark-contributor-cache-hit.okf +148 -0
  115. package/docs/journal/2026/09/03/diagnostics/providers/meta/muse-spark-contributor-required-schema.okf +127 -0
  116. package/docs/journal/2026/09/03/diagnostics/providers/ollama-cloud/kimi-k3-resumed-session-stall.okf +160 -0
  117. package/docs/journal/2026/09/03/diagnostics/providers/ollama-cloud/kimi-k3-substantive-dangling-action.okf +94 -0
  118. package/docs/journal/2026/09/03/diagnostics/remote/kevin/codex-gpt-early-turn-completion.okf +162 -0
  119. package/docs/journal/2026/09/03/implementation/runtimes/meta/muse-code/default-yolo.okf +40 -0
  120. package/docs/journal/2026/09/03/implementation/runtimes/meta/muse-code/native-subscription-router.okf +86 -0
  121. package/docs/journal/2026/09/03/operations/deployment/local/session-socket-default-fallback.okf +41 -0
  122. package/docs/journal/2026/09/03/research/deployment/colab/tailscale/credential-storage.okf +41 -0
  123. package/docs/journal/2026/09/03/research/providers/meta/muse-code/subscription-billing-boundary.okf +64 -0
  124. package/docs/journal/2026/09/03/research/web-chat/voice/instruction-format.okf +135 -0
  125. package/docs/journal/2026/09/04/diagnostics/claude/context/early-auto-compaction.okf +75 -0
  126. package/docs/journal/2026/09/04/diagnostics/claude/context/fable-51-status-200k.okf +54 -0
  127. package/docs/journal/2026/09/04/diagnostics/runtime/codex/responses/replayed-item-id-validation.okf +74 -0
  128. package/docs/journal/2026/09/04/diagnostics/workspaces/onecieldmsui/codex/replay-stall.okf +100 -0
  129. package/docs/journal/2026/09/04/implementation/observability/tool-calls/websocket-stream.okf +49 -0
  130. package/docs/journal/2026/09/04/implementation/web-chat/input/raw-injection.okf +42 -0
  131. package/docs/journal/2026/09/05/diagnostics/tty/claude-raw-idle-render.okf +25 -0
  132. package/docs/journal/2026/09/05/implementation/events/search-response-urls.okf +23 -0
  133. package/docs/journal/2026/09/05/implementation/tools/native-injection.okf +19 -0
  134. package/docs/journal/2026/09/05/implementation/windows/conpty/prompt-delivery-lifecycle.okf +43 -0
  135. package/docs/journal/2026/09/05/release/nightly/conpty-native-tools.okf +13 -0
  136. package/docs/journal/2026/09/05/release/nightly/search-result-urls.okf +14 -0
  137. package/docs/journal/2026/09/06/implementation/codex/inherited-web-mcp.okf +22 -0
  138. package/docs/journal/2026/09/07/integration/main/nightly-merge.okf +13 -0
  139. package/docs/journal/2026/09/07/release/stable/0.2.38.okf +10 -0
  140. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ task:
2
+ id: main-merge-local-deploy-20260902
3
+ request:
4
+ - Merge the Claude session-socket nightly into main.
5
+ - Deploy the merged source locally.
6
+ - Return to the nightly branch.
7
+ status: complete
8
+
9
+ source_control:
10
+ previous_main: 6ecdc61
11
+ merged_nightly: 04fd5f7
12
+ merge_mode: fast-forward
13
+ feature_commit: 60846f9
14
+
15
+ verification:
16
+ full_test_suite:
17
+ command: npm test
18
+ exit_code: 0
19
+ groups:
20
+ unit: "1358 tests; OK; 45 skipped"
21
+ router: "1064 tests; OK"
22
+ channel: "403 tests; OK; 80 skipped"
23
+ runtime: "258 tests; OK; 12 skipped"
24
+ local_deployment:
25
+ command: .\\install.ps1
26
+ target: C:\\Users\\djlov\\.local\\share\\ciel-runtime
27
+ executable: C:\\Users\\djlov\\.local\\bin\\ciel-runtime.ps1
28
+ reported_version: 0.2.37
29
+ module_import: ok
30
+ windows_pipe_prefix_probe: true
31
+ source_module_sha256: F7774A5A0405A6016A152D78A81D5CFBD4EC75DF3122F1D4A05A921FCE5427E6
32
+ installed_module_sha256: F7774A5A0405A6016A152D78A81D5CFBD4EC75DF3122F1D4A05A921FCE5427E6
33
+
34
+ result:
35
+ main_contains_claude_socket_feature: true
36
+ local_deployment_matches_source: true
@@ -0,0 +1,54 @@
1
+ task:
2
+ id: local-nightly-cache-deployment-20260902
3
+ request:
4
+ - Deploy the verified source tree to the local Ciel Runtime installation.
5
+ - Commit the verified provider, context, transport, and cache corrections on nightly.
6
+ - Push nightly so the npm publication workflows can consume it.
7
+ recorded_phase: release_candidate_verified_before_push
8
+
9
+ source_control:
10
+ branch: nightly
11
+ starting_head: 8f9d8b9
12
+ origin_nightly_before: 8f9d8b9
13
+ fetch_before_deployment: passed
14
+ force_push_authorized: false
15
+ intended_push: git push origin nightly
16
+
17
+ verification_before_deployment:
18
+ full_test_suite:
19
+ unit: {tests: 1358, skipped: 45, result: passed}
20
+ router: {tests: 1074, result: passed}
21
+ channel: {tests: 403, skipped: 80, result: passed}
22
+ runtime: {tests: 258, skipped: 12, result: passed}
23
+ ruff: passed
24
+ documentation_metadata: passed
25
+ npm_pack_dry_run: passed
26
+ live_alibaba_cache_probe:
27
+ provider: alitoken
28
+ input_tokens: 53934
29
+ cached_tokens: 53895
30
+ uncached_tokens: 39
31
+ cache_hit_percent: 99.9277
32
+
33
+ local_deployment:
34
+ command: .\\install.ps1
35
+ result: passed
36
+ target: C:/Users/djlov/.local/share/ciel-runtime
37
+ launcher: C:/Users/djlov/.local/bin/ciel-runtime.ps1
38
+ reported_version: 0.2.37
39
+ installed_projection_probe:
40
+ responses_session_cache: enable
41
+ chat_session_cache: null
42
+ configured_effort: xhigh
43
+ source_installed_sha256_matches:
44
+ ciel_runtime.py: true
45
+ ciel_runtime_support/providers/alibaba.py: true
46
+ ciel_runtime_support/provider_request_access.py: true
47
+ ciel_runtime_support/provider_responses_passthrough.py: true
48
+
49
+ runtime_boundary:
50
+ active_router_restarted: false
51
+ reason: >-
52
+ Local installation replacement is complete. Existing Python router
53
+ processes retain already-loaded modules until their next restart; the
54
+ active user session was not interrupted for release deployment.
@@ -0,0 +1,58 @@
1
+ task:
2
+ id: ollama-kimi-recovery-model-audit-nightly-deployment-20260902
3
+ request: >-
4
+ Deploy all currently verified Ciel Runtime changes locally and publish them
5
+ through the nightly branch.
6
+ recorded_at: 2026-09-02T21:45:00-05:00
7
+ status: ready_for_nightly_push
8
+
9
+ release_scope:
10
+ runtime_changes:
11
+ - Preserve complete assistant content, including thinking, during Kimi K3 continuation recovery.
12
+ - Apply a bounded three-attempt continuation loop for Ollama Cloud Kimi K3 progress-only turns.
13
+ - Keep compacted summary metadata byte-stable across small per-request budget changes.
14
+ - Add the documented GLM-5.3 low/high/max reasoning profile.
15
+ - Use boolean thinking for Ollama models without a documented string-level contract.
16
+ tests:
17
+ - tests/test_codex_turn_recovery.py
18
+ - tests/test_context_summary_compatibility_api.py
19
+ - tests/test_ollama_provider_options.py
20
+ evidence_journals:
21
+ - docs/journal/2026/09/02/diagnostics/providers/ollama-cloud/kimi-k3-agent-turn-recovery.okf
22
+ - docs/journal/2026/09/02/diagnostics/providers/ollama-cloud/kimi-k3-parameters.okf
23
+ - docs/journal/2026/09/02/diagnostics/cache/ollama-cloud/kimi-k3-codex-hit-rate.okf
24
+ - docs/journal/2026/09/02/research/providers/ollama-cloud/desktop-model-exhaustive-audit.okf
25
+ - docs/journal/2026/09/02/monitoring/cache/alibaba/cielarvis-qwen38-live-hit-rate.okf
26
+
27
+ verification_before_push:
28
+ full_suite:
29
+ command: npm test
30
+ unit: {tests: 1363, skipped: 45, result: passed}
31
+ router: {tests: 1077, result: passed}
32
+ channel: {tests: 403, skipped: 80, result: passed}
33
+ runtime: {tests: 261, skipped: 12, result: passed}
34
+ total_tests: 3104
35
+ ollama_focused_suite: {tests: 76, result: passed}
36
+ ruff_changed_files: passed
37
+ ollama_cloud_live_tool_probe: {models: 19, http_200: 19, correct_tool_calls: 19}
38
+ okf_parse_validation: {files: 21, errors: 0, result: passed}
39
+ credential_pattern_scan: {matching_files: 0}
40
+
41
+ local_deployment:
42
+ command: powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
43
+ target: C:/Users/djlov/.local/share/ciel-runtime
44
+ runtime_source_installed_hash_match: true
45
+ result: passed
46
+
47
+ nightly_delivery:
48
+ branch: nightly
49
+ base_commit: d56c4f7
50
+ workflow: .github/workflows/npm-publish.yml
51
+ package_base_version: 0.2.37
52
+ trigger: push_to_nightly
53
+ commit: pending
54
+ github_workflow_run: pending
55
+ published_version: pending
56
+ registry_verification: pending
57
+
58
+ credentials_recorded: false
@@ -0,0 +1,72 @@
1
+ okf: 1
2
+ task:
3
+ date: "2026-09-02"
4
+ request: >-
5
+ Deploy the verified Alibaba Token Plan cache improvement locally and push
6
+ the verified source to the nightly branch.
7
+ workspace: C:/Users/djlov/ciel-runtime
8
+
9
+ source_control_before_release:
10
+ branch: nightly
11
+ origin_divergence: {behind: 0, ahead: 0}
12
+ force_push_authorized: false
13
+ nightly_trigger: push_to_nightly
14
+ publish_workflow: .github/workflows/npm-publish.yml
15
+ nightly_version_rule: "0.2.37-nightly.<UTC timestamp>.<7-character commit sha>"
16
+
17
+ verification_before_deployment:
18
+ full_suite:
19
+ command: npm test
20
+ result: passed
21
+ total_tests: 3098
22
+ groups:
23
+ - {name: unit, tests: 1361, skipped: 45}
24
+ - {name: router, tests: 1076, skipped: 0}
25
+ - {name: channel, tests: 403, skipped: 80}
26
+ - {name: runtime, tests: 258, skipped: 12}
27
+ lint: {command: npm run lint, result: passed}
28
+ documentation: {command: npm run check:docs, result: passed}
29
+ package:
30
+ command: npm pack --dry-run --json
31
+ result: passed
32
+ version: 0.2.37
33
+ entry_count: 526
34
+ packed_size_bytes: 1739943
35
+ unpacked_size_bytes: 6004414
36
+ live_alibaba_probe:
37
+ provider: alitoken
38
+ model: qwen3.8-max
39
+ warmed_weighted_cache_hit_percent: 99.489
40
+ isolated_router_port: 9490
41
+ isolated_router_stopped_after_capture: true
42
+ evidence: >-
43
+ docs/journal/2026/09/02/implementation/cache/alibaba/qwen38-cache-hit-improvement.okf
44
+
45
+ local_deployment:
46
+ command: powershell -NoProfile -ExecutionPolicy Bypass -File .\\install.ps1
47
+ result: passed
48
+ target: C:/Users/djlov/.local/share/ciel-runtime
49
+ launcher: C:/Users/djlov/.local/bin/ciel-runtime.ps1
50
+ reported_version: 0.2.37
51
+ installed_provider_projection:
52
+ model: qwen3.8-max
53
+ responses_session_cache_requires_previous_response_id: true
54
+ responses_cache_checkpoint_items: 24
55
+ source_installed_sha256_matches:
56
+ ciel_runtime.py: true
57
+ ciel_runtime_support/providers/alibaba.py: true
58
+ ciel_runtime_support/provider_responses_passthrough.py: true
59
+ ciel_runtime_support/prompt_compaction.py: true
60
+ installed_code_tests:
61
+ - {file: tests/test_alibaba_provider.py, tests: 42, result: passed}
62
+ - {file: tests/test_responses_prompt_compaction.py, tests: 11, result: passed}
63
+ - {file: tests/test_meta_provider.py, tests: 23, result: passed}
64
+
65
+ runtime_boundary:
66
+ router_9479_before_install: unreachable
67
+ router_started_or_restarted_by_deployment: false
68
+ note: >-
69
+ The local source installation was replaced without launching a router.
70
+ A future normal runtime launch will load the installed files.
71
+
72
+ credentials_recorded: false
@@ -0,0 +1,233 @@
1
+ task:
2
+ id: qwen38-cache-hit-rate-improvement-research-20260902
3
+ request: >-
4
+ Research evidence-backed ways to increase cache reuse for Codex using
5
+ Alibaba Singapore Token Plan qwen3.8-max through Ciel Runtime.
6
+ scope: research_only
7
+ status: completed
8
+
9
+ environment:
10
+ runtime_repository: C:/Users/djlov/ciel-runtime
11
+ observed_workspace: C:/Users/djlov/cielarvis
12
+ router: http://127.0.0.1:9479
13
+ router_pid: 77820
14
+ router_started_at_utc: 2026-09-02T18:14:11Z
15
+ provider: alitoken
16
+ model: qwen3.8-max
17
+ protocol: openai_responses
18
+ codex_session_id: 01a01dff-f0f0-7ef3-8cde-1d9916510f35
19
+ production_mutated: false
20
+
21
+ measured_state:
22
+ pre_restart_last_14:
23
+ input_tokens: 1932589
24
+ cached_input_tokens: 614400
25
+ weighted_cache_hit_percent: 31.792
26
+ post_restart_latest_15:
27
+ measured_through_utc: 2026-09-02T18:35:53.849Z
28
+ input_tokens: 2281369
29
+ cached_input_tokens: 291885
30
+ weighted_cache_hit_percent: 12.794
31
+ zero_cache_calls: 13
32
+ high_cache_calls: 2
33
+ change_percentage_points: -18.998
34
+ accounting_cross_check: >-
35
+ Router activity cache_read_tokens and Codex last_token_usage.cached_input_tokens
36
+ report the same upstream values. The observed misses are not created by a
37
+ separate Ciel display-only calculation.
38
+
39
+ wire_evidence:
40
+ request_headers:
41
+ configured: {x-dashscope-session-cache: enable}
42
+ projected_on_openai_responses: {x-dashscope-session-cache: enable}
43
+ captured_codex_request:
44
+ body_keys:
45
+ - client_metadata
46
+ - include
47
+ - input
48
+ - instructions
49
+ - model
50
+ - parallel_tool_calls
51
+ - prompt_cache_key
52
+ - reasoning
53
+ - store
54
+ - stream
55
+ - tool_choice
56
+ - tools
57
+ prompt_cache_key: 01a06337-93d7-7cb0-9fba-895f0daa2c44
58
+ store: false
59
+ previous_response_id_present: false
60
+ full_input_history_replayed: true
61
+ isolated_prior_probe:
62
+ condition: two compact stable-prefix requests with session-cache header enabled
63
+ second_input_tokens: 53934
64
+ second_cached_input_tokens: 53895
65
+ second_weighted_cache_hit_percent: 99.928
66
+ interpretation: >-
67
+ The header and upstream cache can produce a near-complete hit. This does
68
+ not prove that the header alone is sufficient for a long changing Codex
69
+ transcript.
70
+
71
+ official_contracts:
72
+ alibaba_responses_session_cache:
73
+ url: https://www.alibabacloud.com/help/en/model-studio/compatibility-with-openai-responses-api
74
+ confirmed:
75
+ - Session cache is opted into with x-dashscope-session-cache=enable.
76
+ - qwen3.8-max uses explicit cache for Responses session cache.
77
+ - The documented multi-turn flow sends only new input and links it with previous_response_id.
78
+ - A response ID remains valid for seven days.
79
+ not_documented:
80
+ - Alibaba does not document prompt_cache_key as its Responses cache control.
81
+ - The page does not document Responses cache_control markers.
82
+ alibaba_context_cache:
83
+ url: https://www.alibabacloud.com/help/en/model-studio/context-cache
84
+ confirmed:
85
+ - Implicit caching is automatic for supported models but hits are not guaranteed.
86
+ - Cacheable repeated content must be a prefix and unique content should follow it.
87
+ - Explicit and implicit caching cannot be used together on one request.
88
+ - Explicit cache requires at least 1024 tokens, has a five-minute TTL reset on hit, and supports at most four markers.
89
+ qwen38_model:
90
+ url: https://docs.modelstudio.console.alibabacloud.com/en/model-studio/qwen3-8-max
91
+ confirmed:
92
+ - The model supports a one-million-token context and context caching.
93
+ - Singapore International input price is USD 2.00 per million tokens.
94
+ - Implicit cache read is USD 0.25 per million tokens, 12.5 percent of normal input.
95
+ - Explicit cache creation is USD 2.50 per million tokens, 125 percent of normal input.
96
+ - Explicit cache read is USD 0.17 per million tokens, 8.5 percent of normal input.
97
+ token_plan:
98
+ url: https://docs.modelstudio.console.alibabacloud.com/en/model-studio/token-plan-personal-faq
99
+ confirmed:
100
+ - Cache hits deduct fewer Token Plan Credits than cache misses.
101
+ - Usage Analysis is the official source of truth for actual Credits deduction.
102
+ openai_responses:
103
+ url: https://developers.openai.com/api/reference/cli/resources/responses/methods/create
104
+ confirmed:
105
+ - previous_response_id is the Responses multi-turn state link.
106
+ - Instructions from a prior response are not automatically carried into the next request.
107
+ - prompt_cache_key is documented as an OpenAI cache bucketing key.
108
+
109
+ local_root_cause_evidence:
110
+ current_compactor:
111
+ source: C:/Users/djlov/ciel-runtime/ciel_runtime_support/prompt_compaction.py
112
+ behavior: >-
113
+ compact_responses_input_for_budget finds a newest tail that fits and
114
+ regenerates the first summary item from every omitted item on each call.
115
+ confirmed_consequence: >-
116
+ When tail_start changes, the summary input set changes. The first wire item
117
+ can therefore change even though the conversation only appended new items.
118
+ live_router_sequence:
119
+ examples:
120
+ - {items_before: 633, items_after: 400, omitted: 233}
121
+ - {items_before: 636, items_after: 403, omitted: 233}
122
+ - {items_before: 669, items_after: 436, omitted: 233}
123
+ conclusion: >-
124
+ During this segment the omitted count and summary input prefix remained
125
+ fixed while reported cache results still alternated between zero and
126
+ near-complete hits. Moving compaction boundaries are therefore a proven
127
+ cache-breaking mechanism, but not a complete explanation for every miss.
128
+ synthetic_prefix_measurement:
129
+ representative_input:
130
+ first_items: 633
131
+ next_items: 636
132
+ repeated_item_chars: 30000
133
+ compaction_budget_tokens: 2240633
134
+ current_compactor:
135
+ first_body_bytes: 8837551
136
+ next_body_bytes: 8837557
137
+ common_prefix_bytes: 19163
138
+ common_prefix_percent: 0.2168
139
+ first_summary_equal: false
140
+ deterministic_per_item_cap_prototype:
141
+ cap_chars_per_item: 12000
142
+ first_body_bytes: 7629029
143
+ next_body_bytes: 7665098
144
+ common_prefix_bytes: 7628972
145
+ common_prefix_percent: 99.9993
146
+ boundary: >-
147
+ The prototype only proves that prefix-stable reduction is technically
148
+ possible. It does not prove acceptable semantic quality and was not
149
+ applied to production.
150
+
151
+ ranked_improvement_paths:
152
+ - rank: 1
153
+ name: stateful_alibaba_responses_continuation
154
+ evidence_strength: official_contract_match_plus_local_wire_gap
155
+ design:
156
+ - Correlate a local session using provider, model, credential fingerprint, prompt_cache_key, and semantic configuration hashes.
157
+ - Capture a completed upstream response ID and persist it with hashes of represented input and output items.
158
+ - On an exact append-only next turn, send only the delta with previous_response_id.
159
+ - Resend the current instructions because Responses does not carry prior instructions forward.
160
+ - Fall back to full replay on divergence, incomplete response, concurrent turn, configuration change, or expiry.
161
+ expected_effect: >-
162
+ Matches Alibaba's documented session-cache flow and removes repeated
163
+ multi-megabyte full-history transport from steady-state turns.
164
+ unverified:
165
+ - Whether Alibaba accepts continuation when the incoming Codex body has store=false.
166
+ - Whether Ciel should opt in to upstream state by forcing store=true; that changes privacy and persistence semantics.
167
+ - Live hit rate, latency, and Credits improvement in the target Token Plan session.
168
+ - rank: 2
169
+ name: prefix_stable_wire_compaction
170
+ evidence_strength: source_inspection_plus_synthetic_reproduction
171
+ design:
172
+ - Keep a persistent compaction checkpoint per prompt_cache_key instead of regenerating the entire first summary every append.
173
+ - Roll the checkpoint only at fixed boundaries and retain append-only stable chunks.
174
+ - Preserve function-call and output pairs and validate semantic loss before release.
175
+ expected_effect: >-
176
+ Keeps the largest reusable prefix byte-identical and benefits Alibaba
177
+ implicit caching even without server-side response state.
178
+ unverified:
179
+ - End-to-end task quality with checkpointed summaries.
180
+ - Production hit-rate increase under Alibaba scheduling.
181
+ - rank: 3
182
+ name: conditional_session_cache_header
183
+ evidence_strength: official_flow_differs_from_current_wire
184
+ design: >-
185
+ Treat x-dashscope-session-cache as a stateful Responses feature: enable it
186
+ for requests carrying a validated previous_response_id, or retain an
187
+ explicit user opt-in until the stateful bridge is proven.
188
+ boundary: >-
189
+ Current data proves that the header alone is insufficient for consistent
190
+ hits. It does not prove that the header causes the misses.
191
+ - rank: 4
192
+ name: chat_completions_explicit_cache_fallback
193
+ evidence_strength: existing_adapter_support_plus_official_chat_cache_contract
194
+ design: >-
195
+ Ciel already places up to four explicit cache_control markers on Alibaba
196
+ Chat Completions messages. A Responses-to-Chat route could use them.
197
+ risk: >-
198
+ Translation can lose native Responses tool and reasoning semantics, so it
199
+ is a fallback rather than the preferred qwen3.8-max Codex path.
200
+
201
+ non_solutions_or_unproven_claims:
202
+ prompt_cache_key_alone: >-
203
+ Codex already sends a stable value. OpenAI documents its cache bucketing use,
204
+ but the Alibaba pages reviewed do not promise that it controls Alibaba cache.
205
+ header_alone: >-
206
+ Near-complete hits and complete misses were both observed while the header
207
+ was present, so no deterministic improvement claim is supported.
208
+ smaller_context_only: >-
209
+ Clearing or shrinking history can reduce billed input but is not itself a
210
+ cache-hit mechanism and discards context.
211
+
212
+ implementation_boundary:
213
+ code_changed: false
214
+ live_router_restarted: false
215
+ live_session_interrupted: false
216
+ next_validation_required_before_claiming_improvement:
217
+ - Prototype previous_response_id continuation against Alibaba using a Ciel-isolated session without violating Token Plan direct-API restrictions.
218
+ - Compare identical workloads for weighted cached_input_tokens, first-token latency, total latency, and Usage Analysis Credits.
219
+ - Property-test append-only prefix stability and call/output pair integrity for checkpointed compaction.
220
+
221
+ follow_up:
222
+ status: implemented_and_isolated_live_verified
223
+ journal: C:/Users/djlov/ciel-runtime/docs/journal/2026/09/02/implementation/cache/alibaba/qwen38-cache-hit-improvement.okf
224
+ note: >-
225
+ This research-only snapshot preceded the implementation. The follow-up
226
+ applies stateless implicit-cache routing plus pair-safe prefix checkpoints;
227
+ consult the implementation journal for measured results and boundaries.
228
+
229
+ evidence_paths:
230
+ router_activity: C:/Users/djlov/AppData/Roaming/ciel-runtime/router-instances/9479-a3a719fc6552/router-activity.json
231
+ router_log: C:/Users/djlov/AppData/Roaming/ciel-runtime/router-instances/9479-a3a719fc6552/router.log
232
+ codex_session: C:/Users/djlov/.codex/sessions/2026/08/20/rollout-2026-08-20T02-08-27-01a01dff-f0f0-7ef3-8cde-1d9916510f35.jsonl
233
+ credentials_recorded: false
@@ -0,0 +1,77 @@
1
+ task:
2
+ id: codex-cache-provider-scope-20260902
3
+ request: >-
4
+ Determine whether the cache behavior found with Alibaba Singapore Token
5
+ Plan applies equally to every provider used through Codex.
6
+ status: answered
7
+
8
+ confirmed_scope:
9
+ ciel_prefix_breaking_wire_compaction:
10
+ common_to_all_providers: false
11
+ call_path:
12
+ - openai_responses_router._handle_provider_responses_route
13
+ - ProviderResponsesPassthrough.forward
14
+ - ProviderResponsesPassthrough._fit_provider_request
15
+ - compact_responses_input_for_budget
16
+ activation_conditions:
17
+ - selected upstream protocol is openai_responses
18
+ - provider returns a non-null responses_request_max_bytes
19
+ - encoded request exceeds ninety percent of that limit
20
+ provider_overrides_found:
21
+ alitoken: non_null_limit
22
+ alitoken_individual: null
23
+ all_other_adapters: inherited_null
24
+ conclusion: >-
25
+ The exact summary-regeneration and prefix-destruction mechanism measured
26
+ in the qwen3.8-max Singapore Token Plan session currently activates only
27
+ for the alitoken adapter's oversized native Responses requests.
28
+
29
+ codex_request_shape:
30
+ observed:
31
+ full_input_history_replayed: true
32
+ store: false
33
+ prompt_cache_key_present: true
34
+ previous_response_id_present: false
35
+ passthrough_behavior: >-
36
+ ProviderResponsesPassthrough copies and normalizes the incoming body but
37
+ does not synthesize previous_response_id. Native Responses providers can
38
+ therefore receive this same stateless full-history shape.
39
+ conclusion: >-
40
+ This is a shared exposure for native Responses routes, not proof of a
41
+ shared cache defect. A provider may cache repeated prefixes without
42
+ previous_response_id, may offer a different state mechanism, or may not
43
+ expose prompt caching at all.
44
+
45
+ route_classes:
46
+ native_responses:
47
+ exact_alitoken_compactor_issue: conditional_as_above
48
+ stateful_continuation_opportunity: provider_contract_dependent
49
+ translated_openai_chat_or_anthropic:
50
+ exact_alitoken_compactor_issue: false
51
+ reason: >-
52
+ These routes convert the Codex Responses body before provider transport
53
+ and do not call ProviderResponsesPassthrough._fit_provider_request.
54
+ cache_behavior: provider_specific
55
+ native_codex_backend:
56
+ exact_alitoken_compactor_issue: false
57
+ reason: >-
58
+ The codex-routed branch uses the Codex backend adapter rather than the
59
+ provider Responses passthrough.
60
+
61
+ causal_boundary:
62
+ confirmed:
63
+ - The alitoken wire-size compactor can change the reusable prefix.
64
+ - The compactor is not globally enabled for every provider.
65
+ - Native Responses passthrough does not add previous_response_id.
66
+ not_confirmed:
67
+ - Other providers have not been measured to show Alibaba's 12.794 percent hit rate.
68
+ - Absence of previous_response_id does not by itself prove cache misses.
69
+ - A single cache strategy is not valid for every provider without checking its official contract.
70
+
71
+ source_evidence:
72
+ router_dispatch: C:/Users/djlov/ciel-runtime/ciel_runtime_support/openai_responses_router.py
73
+ native_passthrough: C:/Users/djlov/ciel-runtime/ciel_runtime_support/provider_responses_passthrough.py
74
+ compactor: C:/Users/djlov/ciel-runtime/ciel_runtime_support/prompt_compaction.py
75
+ provider_default: C:/Users/djlov/ciel-runtime/ciel_runtime_support/architecture.py
76
+ alibaba_override: C:/Users/djlov/ciel-runtime/ciel_runtime_support/providers/alibaba.py
77
+ code_changed: false