Skip to content

fix: production readiness review round 2#355

Merged
bicced merged 2 commits intomainfrom
fix/production-readiness-review-2
Mar 6, 2026
Merged

fix: production readiness review round 2#355
bicced merged 2 commits intomainfrom
fix/production-readiness-review-2

Conversation

@bicced
Copy link
Contributor

@bicced bicced commented Mar 6, 2026

Summary

  • CRITICAL: Fix broken Anthropic OAuth tool-calling — _build_anthropic_body was passing OpenAI-format tool messages directly to Anthropic API. Added _convert_messages_to_anthropic() conversion layer.
  • Security: VNC proxy auth (cookie-based), localhost validation for x-mesh-internal, sanitize mesh tool outputs, proper .env value quoting
  • Cleanup: Dead code removal, named constants, parameter clamping, monthly budget caps on all templates
  • Tests: 2 new credential conversion tests, 4 dead tests removed, 3 assertions updated. 1779 passed, 0 regressions.

Changes by category

Critical bug fix

  • src/host/credentials.py: _convert_messages_to_anthropic() — converts OpenAI tool_calls/tool messages to Anthropic tool_use/tool_result format

Security hardening

  • src/host/server.py: ol_session cookie auth on VNC HTTP + WebSocket proxies, localhost validation for x-mesh-internal
  • src/agent/builtins/mesh_tool.py: Sanitize read_agent_history return and list_shared_state keys
  • src/host/runtime.py: _quote_env_value() for shell-safe .env values

Cleanup

  • src/agent/workspace.py: Remove dead load_prompt_context()
  • src/agent/loop.py: Named constants (_FLEET_ROSTER_TTL, _FALLBACK_MAX_TOKENS, _TOOL_HISTORY_LIMIT)
  • src/host/cron.py: _UPDATABLE_FIELDS allowlist
  • src/agent/builtins/subagent_tool.py: MAX_TTL clamping
  • src/agent/server.py: /history days parameter clamping
  • src/templates/*.yaml: Add monthly_usd budget to all 6 templates

Test plan

  • pytest — 1779 passed, 28 skipped, 0 failed (excluding 2 pre-existing dashboard test failures)
  • New tests for _convert_messages_to_anthropic() verify tool_calls → tool_use and consecutive tool_result merging

bicced added 2 commits March 6, 2026 21:51
…ning, cleanup

CRITICAL: Fix broken Anthropic OAuth tool-calling by adding
_convert_messages_to_anthropic() to convert OpenAI-format tool messages
to Anthropic Messages API format in credentials.py.

Security:
- Add ol_session cookie auth to VNC HTTP/WebSocket proxies
- Add localhost validation for x-mesh-internal header bypass
- Sanitize mesh_tool read_agent_history and list_shared_state outputs
- Add _quote_env_value() for proper .env escaping in runtime.py

Cleanup:
- Remove dead load_prompt_context() from workspace.py
- Extract named constants in loop.py (roster TTL, max tokens, history limit)
- Add _UPDATABLE_FIELDS allowlist to cron.py update_job
- Add MAX_TTL clamping in subagent_tool.py
- Add days parameter clamping to /history endpoint
- Add monthly_usd budget to all 6 templates

Tests: 1779 passed, 0 regressions, 28 skipped
PR #354 landed the same OAuth tool message conversion inline.
Remove our extracted _convert_messages_to_anthropic() (now dead code)
and keep origin/main's tests.
@bicced bicced merged commit f00091a into main Mar 6, 2026
3 checks passed
@bicced bicced deleted the fix/production-readiness-review-2 branch March 6, 2026 13:54
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