Skip to content

feat(runtime): add report artifact contract#18

Merged
1aal merged 4 commits into
apecloud-basefrom
fix/runtime-output-artifacts
Jun 9, 2026
Merged

feat(runtime): add report artifact contract#18
1aal merged 4 commits into
apecloud-basefrom
fix/runtime-output-artifacts

Conversation

@1aal

@1aal 1aal commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • treat output-too-long notices with successful exit code and usable stdout as completed warning events (error=false, truncated=true, partial=true, warningReason=output_truncated) while keeping real tool failures as errors
  • provision a per-run controlled HERMES_ARTIFACT_DIR; files explicitly written there by report skills/tools are discovered and surfaced as safe artifact metadata (artifactId, fileName, sizeBytes, mimeType, sha256, kind, source, summary, canBrowse, canDownload) without exposing local paths or file bodies in events
  • add Runtime Manager internal artifact read endpoint: GET /agent/sessions/{session_id}/artifacts/{artifact_id}?user_id=...&run_id=..., returning the controlled file as an attachment for Cloud to wrap with org/conversation/turn/action authorization
  • keep terminal stdout as preview-only warning data: no tools/terminal_tool.py change and no automatic stdout-to-artifact fallback; complete reports must be explicitly written by the report skill/tool into HERMES_ARTIFACT_DIR
  • clean .artifacts directories through both Runtime Manager and generic SessionDB.delete_session(..., sessions_dir=...), and allow Hermes file tool paths to use $HERMES_ARTIFACT_DIR/...

Verification

  • uv run --extra dev pytest tests/runtime_manager tests/tools/test_terminal_output_transform_hook.py -q
  • uv run --extra dev pytest tests/runtime_manager/test_report_artifacts.py::test_file_tool_paths_can_use_hermes_artifact_dir_env -q
  • uv run --extra dev ruff check runtime_manager tools/file_tools.py tools/terminal_tool.py hermes_state.py tests/runtime_manager/test_report_artifacts.py tests/runtime_manager/test_registry.py tests/tools/test_terminal_output_transform_hook.py
  • python3 -m py_compile runtime_manager/artifacts.py runtime_manager/app.py runtime_manager/manager.py runtime_manager/worker_main.py tools/file_tools.py tools/terminal_tool.py hermes_state.py
  • git diff --check && git diff --check origin/apecloud-base...HEAD

Notes

  • Runtime events expose metadata only. Cloud should still enforce org/conversation/turn/action ownership and safe browse/download policy before showing report artifacts to users.
  • The Runtime endpoint currently returns attachment content; Cloud can fetch from Runtime and choose user-facing browse/download behavior with sandbox/CSP and MIME allowlists.

@1aal 1aal force-pushed the fix/runtime-output-artifacts branch from 4a7fc82 to 06f38c5 Compare June 9, 2026 07:22
@1aal 1aal changed the title fix(runtime): emit long tool output as truncated warning feat(runtime): add report artifact contract Jun 9, 2026
@1aal 1aal merged commit e4575fb into apecloud-base Jun 9, 2026
7 checks passed
@1aal 1aal deleted the fix/runtime-output-artifacts branch June 9, 2026 08:14
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