Skip to content

Remove restart infrastructure, generalize WASM channel setup#493

Merged
think-in-universe merged 3 commits intomainfrom
remove-restart-infra
Mar 3, 2026
Merged

Remove restart infrastructure, generalize WASM channel setup#493
think-in-universe merged 3 commits intomainfrom
remove-restart-infra

Conversation

@henrypark133
Copy link
Copy Markdown
Collaborator

@henrypark133 henrypark133 commented Mar 3, 2026

Summary

  • Remove the gateway restart mechanism — hot-activation works, restart won't fix activation failures. restartGateway() was already dead code (defined but never called).
  • Generalize Telegram-specific hardcoded checks so all WASM channels (Slack, Discord, WhatsApp) get equal treatment: pairing status, 3-step stepper, owner_id injection.
  • Remove ~700 lines of dead setup_telegram() code — Telegram's capabilities.json declares required_secrets, so the generic setup_wasm_channel() path handles it.

Test plan

  • cargo clippy --all --benches --tests --examples --all-features — zero warnings
  • cargo test — all pass
  • cargo fmt --check — clean
  • grep -rn 'channel_name == "telegram"\|ext\.name == "telegram"\|isTelegram\|telegram_owner_id' src/ — zero hits
  • Manual: install Telegram channel via web UI, verify 3-step stepper, pairing flow works
  • Manual: verify TELEGRAM_OWNER_ID env var still works (backwards compat)

🤖 Generated with Claude Code

…fic code

Remove the gateway restart mechanism (hot-activation works, restart won't
fix activation failures) and generalize Telegram-specific hardcoded checks
so all WASM channels get equal treatment.

Part 1 - Remove restart infrastructure:
- Remove needs_restart from ActionResponse, restart_requested from GatewayState
- Remove gateway_restart_handler, /api/gateway/restart route, exit code 75
- Remove restart overlay JS/CSS (dead code - restartGateway() never called)
- Surface actual activation errors instead of suggesting restart

Part 2 - Generalize Telegram-specific code:
- Replace telegram_owner_id: Option<i64> with generic
  wasm_channel_owner_ids: HashMap<String, i64> (backwards-compatible
  via TELEGRAM_OWNER_ID env var)
- Pairing status check now applies to all active WASM channels
- All channels get 3-step stepper in web UI, remove "coming soon" note
- Remove dead setup_telegram() code (~700 lines) - Telegram's
  capabilities.json declares required_secrets, so the generic
  setup_wasm_channel() path handles it

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added scope: channel/web Web gateway channel scope: config Configuration scope: extensions Extension management scope: setup Onboarding / setup size: XL 500+ changed lines risk: high Safety, secrets, auth, or critical infrastructure contributor: core 20+ merged PRs labels Mar 3, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the channel management system by eliminating the defunct gateway restart functionality and generalizing the setup process for WASM channels. The changes streamline the codebase, remove dead code, and ensure that all WASM-based channels benefit from a consistent and robust activation and configuration flow, moving away from Telegram-specific special casing.

Highlights

  • Removed Gateway Restart Infrastructure: The unused gateway restart mechanism, including its API route, state flags, and associated UI elements, has been completely removed, as hot-activation is the preferred and functional method.
  • Generalized WASM Channel Setup: Telegram-specific hardcoded checks and setup logic for pairing status, the 3-step stepper, and owner ID injection have been generalized to apply to all WASM channels (e.g., Slack, Discord, WhatsApp), promoting a unified approach.
  • Refactored Telegram Setup Code: Approximately 700 lines of Telegram-specific setup code have been removed, as the generic setup_wasm_channel() path now handles its configuration requirements, leveraging capabilities.json for required_secrets.
Changelog
  • src/channels/web/handlers/extensions.rs
    • Removed Telegram-specific condition for checking active extension status, generalizing it for all active extensions.
  • src/channels/web/mod.rs
    • Removed the restart_requested field from the GatewayChannel struct.
  • src/channels/web/server.rs
    • Removed the restart_requested field from GatewayState struct.
    • Removed the /api/gateway/restart API route and its associated handler.
    • Generalized the logic for determining an active channel's status, removing Telegram-specific checks.
    • Removed the needs_restart flag from the extensions_setup_submit_handler response.
  • src/channels/web/static/app.js
    • Removed the 'coming soon' note previously displayed for non-Telegram WASM channels.
    • Removed client-side logic related to gateway restart, including restartGateway() and showRestartOverlay() functions.
    • Updated submitConfigureModal to remove needs_restart handling.
    • Generalized the WASM channel stepper to consistently use a 3-step process for all channels, removing Telegram-specific conditions.
  • src/channels/web/static/style.css
    • Removed CSS styles associated with the gateway restart overlay.
  • src/channels/web/types.rs
    • Removed the needs_restart field from the ActionResponse struct.
  • src/channels/web/ws.rs
    • Removed the restart_requested field from GatewayState initialization in test utilities.
  • src/config/channels.rs
    • Replaced the telegram_owner_id field with a generic wasm_channel_owner_ids HashMap to store owner IDs for multiple WASM channels.
    • Updated the from_env implementation to populate wasm_channel_owner_ids, maintaining backward compatibility for the TELEGRAM_OWNER_ID environment variable.
  • src/extensions/manager.rs
    • Replaced telegram_owner_id with wasm_channel_owner_ids in ChannelRuntimeState and its initialization.
    • Updated the owner ID injection logic to use the generic wasm_channel_owner_ids map instead of a Telegram-specific field.
    • Removed the suggestion to 'restart IronClaw to activate' from activation failure messages.
  • src/main.rs
    • Removed the gateway_state variable and the associated restart logic at agent shutdown.
    • Updated the ExtensionManager initialization to pass the new wasm_channel_owner_ids map.
    • Generalized the owner ID injection logic for WASM channels during initial setup.
  • src/settings.rs
    • Replaced telegram_owner_id with wasm_channel_owner_ids (a HashMap) in ChannelSettings.
    • Updated to_db_map and from_db_map methods to correctly handle the new wasm_channel_owner_ids structure.
    • Removed Telegram-specific owner ID tests and replaced them with generalized WASM channel owner ID tests.
  • src/setup/channels.rs
    • Removed all Telegram-specific setup functions, including setup_telegram, bind_telegram_owner, setup_telegram_webhook_secret, and validate_telegram_token.
    • Removed Telegram-specific structs and imports related to its API.
    • Updated file comments to reflect the generalized nature of channel setup flows.
  • src/setup/mod.rs
    • Removed setup_telegram and validate_telegram_token from public exports.
  • src/setup/wizard.rs
    • Removed the special handling and call to setup_telegram within the WASM channel setup flow, relying entirely on the generic setup_wasm_channel.
  • tests/openai_compat_integration.rs
    • Removed the restart_requested field from GatewayState initialization in test helper functions.
  • tests/ws_gateway_integration.rs
    • Removed the restart_requested field from GatewayState initialization in test helper functions.
Activity
  • The pull request was created by henrypark133.
  • The pull request includes a comprehensive test plan covering code quality checks, unit tests, and manual verification for the generalized WASM channel setup and owner ID functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively removes the gateway restart infrastructure and generalizes the WASM channel setup, removing Telegram-specific logic. The changes are consistent across the backend, frontend, and tests. I've identified one area for improvement regarding test coverage for the new configuration setting.

Note: Security Review did not run due to the size of the PR.

Comment thread src/settings.rs
Comment on lines 1067 to 1074
#[test]
fn test_telegram_owner_id_default_none() {
fn test_wasm_channel_owner_ids_default_empty() {
let settings = Settings::default();
assert_eq!(settings.channels.telegram_owner_id, None);
}

#[test]
fn test_telegram_owner_id_via_set() {
let mut settings = Settings::default();
settings
.set("channels.telegram_owner_id", "987654321")
.unwrap();
assert_eq!(settings.channels.telegram_owner_id, Some(987654321));
assert!(settings.channels.wasm_channel_owner_ids.is_empty());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The test test_telegram_owner_id_via_set was removed. While the telegram_owner_id field is gone, this test was covering the Settings::set functionality. With the new wasm_channel_owner_ids being a HashMap, it would be beneficial to add a new test to ensure that setting values in this map via the set method works as expected. This would prevent potential regressions in configuration management.

    #[test]
    fn test_wasm_channel_owner_ids_via_set() {
        let mut settings = Settings::default();
        settings
            .set("channels.wasm_channel_owner_ids.telegram", "987654321")
            .unwrap();
        assert_eq!(
            settings.channels.wasm_channel_owner_ids.get("telegram"),
            Some(&987654321)
        );
    }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch — added the test in 20e6f65. The Settings::set() dotted-path API handles this correctly: "987654321" is parsed as a JSON number by the fallback path (line 837) and deserializes into HashMap<String, i64> without issues.

henrypark133 and others added 2 commits March 2, 2026 22:52
Addresses review feedback: verify that setting per-channel owner IDs
via the dotted-path Settings::set() API works correctly with the new
HashMap<String, i64> type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
loadPairingRequests only refreshed the pairing section, not the
stepper status. Call loadExtensions() instead so the stepper updates
from "Awaiting Pairing" to "Active" immediately after approval.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@think-in-universe think-in-universe merged commit 78878ad into main Mar 3, 2026
14 checks passed
@think-in-universe think-in-universe deleted the remove-restart-infra branch March 3, 2026 14:10
@github-actions github-actions Bot mentioned this pull request Mar 3, 2026
mudrii added a commit to mudrii/ironclaw that referenced this pull request Mar 4, 2026
…pdate

Comprehensive v0.14.0 documentation review across all 19 docs files:

- Add v0.13.1 and v0.14.0 release sections to README
- Fix OAuth schema in BUILDING_CHANNELS (remove fabricated fields, correct
  validation_endpoint structure, add full field reference, OAuth callback env vars,
  all credential injection location types, secrets-in-on_start note)
- Add workspace initialization files docs (TOOLS.md/BOOTSTRAP.md) to AGENT_README
- Fix WASM channel hot-activation (v0.14.0 nearai#493), remove all "requires restart" refs
- Remove non-existent POST /api/gateway/restart route from channels.md
- Add TOOLS.md/BOOTSTRAP.md to workspace-memory seeded files and identity table
- Add disk-to-DB import section to workspace-memory
- Add Brave Web Search tool documentation (v0.13.1 nearai#474)
- Add OAuth for WASM tools section to config.md with WASM_CHANNEL_OWNER_IDS env var
- Add Worker SSE streaming and routine thread_id isolation to agent.md
- Update all 19 files to v0.14.0 version headers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mudrii added a commit to mudrii/ironclaw that referenced this pull request Mar 9, 2026
…pdate

Comprehensive v0.14.0 documentation review across all 19 docs files:

- Add v0.13.1 and v0.14.0 release sections to README
- Fix OAuth schema in BUILDING_CHANNELS (remove fabricated fields, correct
  validation_endpoint structure, add full field reference, OAuth callback env vars,
  all credential injection location types, secrets-in-on_start note)
- Add workspace initialization files docs (TOOLS.md/BOOTSTRAP.md) to AGENT_README
- Fix WASM channel hot-activation (v0.14.0 nearai#493), remove all "requires restart" refs
- Remove non-existent POST /api/gateway/restart route from channels.md
- Add TOOLS.md/BOOTSTRAP.md to workspace-memory seeded files and identity table
- Add disk-to-DB import section to workspace-memory
- Add Brave Web Search tool documentation (v0.13.1 nearai#474)
- Add OAuth for WASM tools section to config.md with WASM_CHANNEL_OWNER_IDS env var
- Add Worker SSE streaming and routine thread_id isolation to agent.md
- Update all 19 files to v0.14.0 version headers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
)

* refactor: remove restart infrastructure and generalize Telegram-specific code

Remove the gateway restart mechanism (hot-activation works, restart won't
fix activation failures) and generalize Telegram-specific hardcoded checks
so all WASM channels get equal treatment.

Part 1 - Remove restart infrastructure:
- Remove needs_restart from ActionResponse, restart_requested from GatewayState
- Remove gateway_restart_handler, /api/gateway/restart route, exit code 75
- Remove restart overlay JS/CSS (dead code - restartGateway() never called)
- Surface actual activation errors instead of suggesting restart

Part 2 - Generalize Telegram-specific code:
- Replace telegram_owner_id: Option<i64> with generic
  wasm_channel_owner_ids: HashMap<String, i64> (backwards-compatible
  via TELEGRAM_OWNER_ID env var)
- Pairing status check now applies to all active WASM channels
- All channels get 3-step stepper in web UI, remove "coming soon" note
- Remove dead setup_telegram() code (~700 lines) - Telegram's
  capabilities.json declares required_secrets, so the generic
  setup_wasm_channel() path handles it

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add Settings::set() test for wasm_channel_owner_ids

Addresses review feedback: verify that setting per-channel owner IDs
via the dotted-path Settings::set() API works correctly with the new
HashMap<String, i64> type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): refresh extension stepper after pairing approval

loadPairingRequests only refreshed the pairing section, not the
stepper status. Call loadExtensions() instead so the stepper updates
from "Awaiting Pairing" to "Active" immediately after approval.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: high Safety, secrets, auth, or critical infrastructure scope: channel/web Web gateway channel scope: config Configuration scope: extensions Extension management scope: setup Onboarding / setup size: XL 500+ changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants