Skip to content

T-12: relay-runner init — cloud mode extension#65

Merged
kirich1409 merged 2 commits intomainfrom
feature/t12-init-cloud-clean
Apr 13, 2026
Merged

T-12: relay-runner init — cloud mode extension#65
kirich1409 merged 2 commits intomainfrom
feature/t12-init-cloud-clean

Conversation

@kirich1409
Copy link
Copy Markdown
Contributor

Summary

Implement three new CLI commands for cloud-ready initialization:

  • init --cloud: Generate cloud-ready configuration with bearer token, data directory structure, and SQLite database initialization with WAL mode
  • add-profile: Add container session profile templates to config.toml
  • rotate-token: Generate new bearer token and update config hash

Backward compatible: init without --cloud works as before.

Acceptance Criteria

  • relay-runner init --cloud generates valid config.toml with [docker], [git], [[profiles]] sections and top-level rest_port/data_dir
  • data_dir created with correct structure (projects/, workspaces/, sessions/)
  • relay.db initialized with sqlx migrations, WAL mode enabled
  • relay-runner add-profile adds profiles without errors
  • relay-runner init (no --cloud) works as before (backward compat)
  • relay-runner rotate-token generates new token and updates config hash

Testing

cd runner
cargo build
cargo fmt --check
cargo clippy -- -D warnings
cargo test

All checks pass.

Closes #23

Implement three new CLI commands for cloud-ready initialization:

- init --cloud: Generate cloud-ready configuration with bearer token,
  data directory structure (projects/, workspaces/, sessions/), and SQLite
  database initialization with WAL mode
- add-profile: Add container session profile templates to config.toml
- rotate-token: Generate new bearer token and update config hash

Backward compatible: init without --cloud works as before.

Acceptance criteria met:
1. relay-runner init --cloud generates valid config.toml with [docker], [git],
   [[profiles]] sections and top-level rest_port/data_dir
2. data_dir created with correct structure (projects, workspaces, sessions)
3. relay.db initialized with sqlx migrations, WAL mode enabled
4. relay-runner add-profile adds profiles without errors
5. relay-runner init (no --cloud) works as before (backward compat)
6. relay-runner rotate-token generates new token and updates config hash
Copilot AI review requested due to automatic review settings April 13, 2026 17:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “cloud mode” initialization and related CLI management commands to relay-runner, aiming to bootstrap a cloud-ready config, data directory layout, and SQLite DB setup while keeping existing init behavior unchanged.

Changes:

  • Extend init with --cloud to generate a cloud-oriented config.toml, create data_dir subdirectories, and initialize relay.db with migrations + WAL.
  • Add add-profile to append [[profiles]] entries to config.toml.
  • Add rotate-token to generate a new bearer token and update auth.token_hash in config.toml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runner/src/main.rs
Comment thread runner/src/main.rs
Comment thread runner/src/main.rs
Comment thread runner/src/main.rs
Comment thread runner/src/main.rs
Comment thread runner/src/main.rs
Comment thread runner/src/main.rs
Comment thread runner/src/main.rs Outdated
- generate_secure_token: use File::open + read_exact instead of fs::read
  on /dev/urandom (unbounded stream would hang or OOM)
- rotate-token: fix line_end double-counting token_hash_line_pos offset
- add-profile: validate name/image against TOML injection characters
- init --cloud: only print bearer token when config.toml was actually
  written (avoids showing a token that doesn't match the stored hash)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kirich1409 kirich1409 merged commit 00b8161 into main Apr 13, 2026
10 checks passed
@kirich1409 kirich1409 deleted the feature/t12-init-cloud-clean branch April 13, 2026 17:49
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.

T-12: relay-runner init — расширение для cloud mode

2 participants