Skip to content

test: isolate runtime-home-backed state from ambient LOONG_HOME#1237

Merged
gh-xj merged 11 commits intoeastreams:devfrom
chumyin:refactor/hermetic-runtime-home-isolation-20260413
Apr 14, 2026
Merged

test: isolate runtime-home-backed state from ambient LOONG_HOME#1237
gh-xj merged 11 commits intoeastreams:devfrom
chumyin:refactor/hermetic-runtime-home-isolation-20260413

Conversation

@chumyin
Copy link
Copy Markdown
Collaborator

@chumyin chumyin commented Apr 13, 2026

Summary

  • Problem:
    Tool-runtime and config tests were still reading runtime-home-backed state from ambient LOONG_HOME unless each test manually set and cleared it, and the tool lease secret publisher still needed a bounded post-publish visibility path for concurrent first use.
  • Why it matters:
    The suite could go red for the wrong reasons, especially on Windows or under parallel execution, because one test's runtime home leaked into another test's secret store or default-path assertions.
  • What changed:
    • added a shared ScopedLoongClawHome helper in test_support and made ScopedEnv reentrant on one thread so nested hermetic-home scopes stay safe
    • migrated the highest-signal runtime-home-sensitive tests to explicit hermetic home scopes instead of ambient defaults
    • wrapped the common tool test runtime helper so lease-sensitive tool tests automatically hold a scoped runtime home
    • kept the tool lease authority production semantics home-based, but hardened first-use secret publication with atomic staging plus a bounded post-publish visibility wait
    • preserved the conversation ambient-state fix so the combined reliability lane stays green under full-suite verification
  • What did not change (scope boundary):
    • no product-facing runtime-home contract changed
    • no new config fields or dependencies were introduced
    • no public plugin/extension/runtime APIs changed

Linked Issues

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Security hardening
  • CI / workflow / release

Touched Areas

  • Kernel / policy / approvals
  • Contracts / protocol / spec
  • Daemon / CLI / install
  • Providers / routing
  • Tools
  • Browser automation
  • Channels / integrations
  • ACP / conversation / session runtime
  • Memory / context assembly
  • Config / migration / onboarding
  • Docs / contributor workflow
  • CI / release / workflows

Risk Track

  • Track A (routine / low-risk)
  • Track B (higher-risk / policy-impacting)

Validation

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --locked
  • cargo test --workspace --all-features --locked
  • Relevant architecture / dep-graph / docs checks for touched areas
  • Additional scenario, benchmark, or manual checks when behavior changed
  • If tests mutate process-global env: document how state is restored or serialized

Commands and evidence:

export CARGO_TARGET_DIR="$HOME/.cache/loongclaw-target"
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test -p loongclaw-app --lib scoped_env_supports_nested_guards_on_one_thread -- --nocapture
cargo test -p loongclaw-app --lib handle_turn_with_runtime_safe_lane_executes_session_wait_via_default_dispatcher -- --nocapture
cargo test -p loongclaw-app --lib tool_search_matches_multilingual_queries_across_languages -- --nocapture
cargo test -p loongclaw-app --lib tool_search_creates_tool_lease_secret_under_scoped_runtime_home -- --nocapture
cargo test -p loongclaw-app --lib from_env_enables_feishu_runtime_when_credentials_exist -- --nocapture
cargo test -p loongclaw-app --lib feishu_integration_defaults_use_dedicated_runtime_db -- --nocapture
cargo test -p loongclaw-app --lib audit_config_defaults_to_fanout_under_loongclaw_home -- --nocapture
cargo test -p loongclaw-app --lib model_catalog_cache_ttl_default_and_clamp_are_stable -- --nocapture
cargo test -p loongclaw-app --lib
cargo test --workspace --locked
cargo test --workspace --all-features --locked
./scripts/check_architecture_boundaries.sh

All commands passed locally.

User-visible / Operator-visible Changes

  • None in product behavior.
  • Contributors and CI runners should see fewer false-red failures from ambient runtime-home leakage.

Failure Recovery

  • Fast rollback or disable path:
    Revert 41d73f029 and aea874e01.
  • Observable failure symptoms reviewers should watch for:
    Tests unexpectedly reading another test's runtime-home-backed secret or default sqlite path.

Reviewer Focus

  • crates/app/src/test_support.rs
  • crates/app/src/tools/tool_lease_authority.rs
  • crates/app/src/tools/mod.rs
  • crates/app/src/tools/runtime_config.rs
  • crates/app/src/config/{audit.rs,feishu_integration.rs,mod.rs}

Please focus on whether the new hermetic-home helper stays test-only, whether the tool lease authority keeps production semantics clean, and whether the migrated tests now express runtime-home ownership explicitly instead of relying on ambient state.

chumyin added 2 commits April 13, 2026 15:39
The flaky conversation tests relied on thread-local env overrides and ambient filesystem defaults. Tokio multi-threaded tests and default audit or file roots allowed state to disappear or leak across unrelated tests. Use process-wide synchronized test overrides, bind file tool roots to harness temp directories, and keep the bootstrap audit sink in-memory for isolated tests.

Constraint: Tests must stay compatible with existing runtime selection helpers and harness setup
Rejected: Serialize the entire suite | hides the isolation bug and slows CI
Rejected: Add retries or sleeps | masks shared-state defects instead of fixing them
Confidence: high
Scope-risk: narrow
Directive: Test-only runtime overrides must remain visible across spawned threads and must not depend on ambient cwd or HOME-derived defaults
Tested: cargo fmt --all -- --check
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test --workspace --locked
Tested: cargo test --workspace --all-features --locked
Tested: ./scripts/check_architecture_boundaries.sh
Not-tested: GitHub Actions rerun for this branch
Tool lease publication and lookup still depended on ambient runtime-home state in tests, which made Windows and concurrent test runs vulnerable to shared LOONG_HOME leakage. Introduce a shared scoped runtime-home helper in test_support, use it in lease-sensitive test entrypoints, keep the tool lease authority responsible only for atomic secret publication plus bounded post-publish visibility, and preserve the conversation ambient-state fix on this branch so the combined lane verifies cleanly.

Constraint: Production runtime-home resolution must continue to flow through default_loongclaw_home rather than test-only shortcuts
Rejected: Add a runtime_home field to ToolRuntimeConfig | broader product-surface expansion than needed for test isolation
Rejected: Keep cfg(test) home overrides inside tool execution and tool_lease_authority | effective spike, but it pollutes production paths with test-only semantics
Confidence: high
Scope-risk: moderate
Directive: New tests that exercise runtime-home-backed state should prefer ScopedLoongClawHome over ad hoc LOONG_HOME mutation or ambient defaults
Tested: cargo fmt --all
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test -p loongclaw-app --lib scoped_env_supports_nested_guards_on_one_thread -- --nocapture
Tested: cargo test -p loongclaw-app --lib handle_turn_with_runtime_safe_lane_executes_session_wait_via_default_dispatcher -- --nocapture
Tested: cargo test -p loongclaw-app --lib tool_search_matches_multilingual_queries_across_languages -- --nocapture
Tested: cargo test -p loongclaw-app --lib tool_search_creates_tool_lease_secret_under_scoped_runtime_home -- --nocapture
Tested: cargo test -p loongclaw-app --lib from_env_enables_feishu_runtime_when_credentials_exist -- --nocapture
Tested: cargo test -p loongclaw-app --lib feishu_integration_defaults_use_dedicated_runtime_db -- --nocapture
Tested: cargo test -p loongclaw-app --lib audit_config_defaults_to_fanout_under_loongclaw_home -- --nocapture
Tested: cargo test -p loongclaw-app --lib model_catalog_cache_ttl_default_and_clamp_are_stable -- --nocapture
Tested: cargo test -p loongclaw-app --lib
Tested: cargo test --workspace --locked
Tested: cargo test --workspace --all-features --locked
Tested: ./scripts/check_architecture_boundaries.sh
Related: eastreams#1219
Not-tested: GitHub Actions rerun for this follow-up branch
@github-actions github-actions bot added tools Tool runtime, policy adapters, and tool catalog behavior. conversation Conversation runtime, session flow, and prompt assembly. config Runtime config parsing, schema, and defaults. size: M Medium pull request: 201-500 changed lines. labels Apr 13, 2026
… fixes

The governance workflow expects the tracked April architecture drift report to match the branch state. Refresh the snapshot after the hermetic runtime-home refactor so the freshness gate reflects the current tools module metrics.

Constraint: Governance consumes the tracked monthly report path directly and fails closed when it is stale
Rejected: Skip the drift refresh on feature branches | leaves governance red for a non-code mismatch
Confidence: high
Scope-risk: narrow
Directive: Any branch that changes tracked hotspot files and carries the monthly drift artifact should refresh it before expecting governance to pass
Tested: scripts/generate_architecture_drift_report.sh docs/releases/architecture-drift-2026-04.md
Tested: bash scripts/check_architecture_drift_freshness.sh docs/releases/architecture-drift-2026-04.md
Related: eastreams#1236
Not-tested: GitHub Actions rerun after this snapshot refresh
@github-actions github-actions bot added the documentation Improvements or additions to documentation. label Apr 13, 2026
@chumyin
Copy link
Copy Markdown
Collaborator Author

chumyin commented Apr 13, 2026

Follow-up pushed in 954b95210 to refresh docs/releases/architecture-drift-2026-04.md after the hermetic-home refactor. The governance workflow failed on the standard freshness gate, so I regenerated the tracked April snapshot and re-checked it locally with:

  • scripts/generate_architecture_drift_report.sh docs/releases/architecture-drift-2026-04.md
  • bash scripts/check_architecture_drift_freshness.sh docs/releases/architecture-drift-2026-04.md

This keeps the tracked drift artifact aligned with the current tools_mod size/function counts.

The first hermetic-home pass still left tool-lease cache clearing scattered across tests. Move that cleanup into the shared ScopedLoongClawHome lifecycle and expose one narrow tools-level reset hook so tests stop hand-managing runtime-home cache invalidation.

Constraint: Runtime-home cache resets must stay test-only and must not leak new production APIs
Rejected: Leave per-test clear calls in place | works, but keeps the cleanup policy duplicated and easy to forget
Rejected: Let ScopedLoongClawHome reach into tool_lease_authority directly | tighter module coupling than a single tools-level reset hook
Confidence: high
Scope-risk: narrow
Directive: New runtime-home-scoped helpers should own both env setup and cache cleanup so individual tests only express intent, not lifecycle plumbing
Tested: cargo fmt --all
Tested: cargo test -p loongclaw-app --lib scoped_env_supports_nested_guards_on_one_thread -- --nocapture
Tested: cargo test -p loongclaw-app --lib issue_tool_lease_parallel_first_use_keeps_secret_readable -- --nocapture
Tested: cargo test -p loongclaw-app --lib tool_search_creates_tool_lease_secret_under_scoped_runtime_home -- --nocapture
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Related: eastreams#1236
Not-tested: Full workspace rerun after this cleanup-only follow-up
@chumyin
Copy link
Copy Markdown
Collaborator Author

chumyin commented Apr 13, 2026

Small follow-up pushed in f5bc60a86.

This does not change the runtime-home model again; it just centralizes the test-only cache reset lifecycle:

  • ScopedLoongClawHome now resets runtime-home-sensitive test state on enter/exit
  • lease-sensitive tests no longer need to call the tool-lease cache clearer manually
  • a single tools::reset_runtime_home_state_for_tests() hook owns the current cache reset surface

Targeted re-checks after the follow-up:

  • cargo fmt --all
  • cargo test -p loongclaw-app --lib scoped_env_supports_nested_guards_on_one_thread -- --nocapture
  • cargo test -p loongclaw-app --lib issue_tool_lease_parallel_first_use_keeps_secret_readable -- --nocapture
  • cargo test -p loongclaw-app --lib tool_search_creates_tool_lease_secret_under_scoped_runtime_home -- --nocapture
  • cargo clippy --workspace --all-targets --all-features -- -D warnings

The first hermetic-home pass still left several default-path tests mutating HOME or LOONG_HOME directly, and conversation env-override helpers could cascade poison failures after a single panic. Extend the shared runtime-home helper to drive config defaults through a test-only home override, migrate another bounded slice of rules-dir and memory-path tests onto that helper, teach the parallel tool-lease test to reapply the override inside worker threads, and harden the conversation env-test scaffolding against lock poisoning.

Constraint: Production runtime-home resolution and runtime config initialization contracts must stay unchanged
Rejected: Add a product-facing runtime_home field or runtime reset API | too broad for a test-isolation lane
Rejected: Keep relying on process-global HOME/LOONG_HOME mutation in migrated tests | leaves cross-suite contamination risks in place
Confidence: medium
Scope-risk: moderate
Directive: Tests that only need a stable default runtime-home path should use ScopedLoongClawHome; reserve real env mutation for env-resolution semantics tests only
Tested: cargo fmt --all
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test -p loongclaw-app --lib issue_tool_lease_parallel_first_use_keeps_secret_readable -- --nocapture
Tested: cargo test -p loongclaw-app --lib handle_turn_with_runtime_tool_search_raw_request_still_uses_followup_provider_turn -- --nocapture
Tested: cargo test -p loongclaw-app --lib handle_turn_with_runtime_provider_shape_function_calls_multi_step_chain_continues -- --nocapture
Tested: cargo test -p loongclaw-app --lib handle_turn_with_runtime_safe_lane_executes_session_tools_via_default_dispatcher -- --nocapture
Tested: cargo test -p loongclaw-app --lib handle_turn_with_runtime_safe_lane_executes_sessions_send_via_default_dispatcher -- --nocapture
Tested: cargo test -p loongclaw-app --lib handle_turn_with_runtime_safe_lane_executes_session_wait_via_default_dispatcher -- --nocapture
Tested: cargo test -p loongclaw-app --lib bash_tool_config_defaults_to_loongclaw_home_rules_dir -- --nocapture
Tested: cargo test -p loongclaw-app --lib bash_tool_config_treats_blank_rules_dir_override_as_unset -- --nocapture
Tested: cargo test -p loongclaw-app --lib tool_runtime_config_uses_loongclaw_home_rules_dir_when_unset -- --nocapture
Tested: cargo test -p loongclaw-app --lib bash_governance_runtime_treats_missing_rules_dir_as_empty_rule_set -- --nocapture
Tested: cargo test -p loongclaw-app --lib bash_governance_runtime_preserves_rule_load_error_for_broken_rule_file -- --nocapture
Tested: cargo test -p loongclaw-app --lib memory_sqlite_path_from_env_falls_back_to_loongclaw_home -- --nocapture
Tested: cargo test -p loongclaw-app --lib empty_legacy_memory_sqlite_path_falls_back_to_loongclaw_home -- --nocapture
Related: #1236
Not-tested: A consistently green full
running 596 tests
test audit_cli::tests::audit_recent_rejects_excessive_limit ... ok
test audit_cli::tests::audit_discovery_rejects_until_before_since ... ok
test audit_cli::tests::audit_recent_rejects_zero_limit ... ok
test audit_cli::tests::audit_discovery_rejects_excessive_limit ... ok
test audit_cli::tests::audit_discovery_group_drill_down_command_preserves_filters ... ok
test audit_cli::tests::audit_discovery_group_correlated_summary_command_broadens_to_workload_window ... ok
test audit_cli::tests::audit_discovery_group_correlated_remediation_command_targets_token_summary ... ok
test audit_cli::tests::audit_recent_text_renders_tool_search_trust_conflict_details ... ok
test audit_cli::tests::audit_discovery_text_and_json_render_trust_rollups ... ok
test audit_cli::tests::audit_recent_reports_missing_journal_with_first_write_hint ... ok
test audit_cli::tests::audit_recent_reports_in_memory_mode_when_journal_is_missing ... ok
test audit_cli::tests::audit_repair_reports_healthy_for_valid_chain ... ok
test audit_cli::tests::audit_summary_json_includes_triage_fields ... ok
test audit_cli::tests::audit_summary_json_uses_empty_and_null_triage_fields_when_no_triage_events_exist ... ok
test audit_cli::tests::audit_recent_filters_by_time_window_inclusively ... ok
test audit_cli::tests::audit_recent_execution_keeps_last_events_in_order ... ok
test audit_cli::tests::audit_recent_filters_by_kind_and_uses_filtered_window_limit ... ok
test audit_cli::tests::audit_recent_filters_by_pack_id_and_agent_id ... ok
test audit_cli::tests::audit_recent_filters_by_query_contains_and_trust_tier ... ok
test audit_cli::tests::audit_summary_rejects_excessive_limit ... ok
test audit_cli::tests::audit_summary_text_includes_triage_counts_and_last_seen_fields ... ok
test audit_cli::tests::audit_summary_text_uses_placeholders_when_no_triage_events_exist ... ok
test audit_cli::tests::audit_summary_filters_by_agent_id ... ok
test audit_cli::tests::audit_summary_filters_by_triage_label ... ok
test audit_cli::tests::audit_recent_json_includes_loaded_events_and_journal_path ... ok
test audit_cli::tests::audit_discovery_filters_tool_search_events_and_rolls_up_trust_context ... ok
test audit_cli::tests::audit_summary_groups_by_token ... ok
test browser_companion_diagnostics::tests::browser_companion_probe_timeout_duration_saturates ... ok
test audit_cli::tests::audit_token_trail_text_and_json_render_lifecycle ... ok
test audit_cli::tests::audit_discovery_groups_by_agent ... ok
test audit_cli::tests::audit_repair_reports_refused_for_tampered_journal ... ok
test audit_cli::tests::audit_recent_filters_by_event_id_and_token_id ... ok
test audit_cli::tests::audit_verify_reports_missing_journal_with_first_write_hint ... ok
test audit_cli::tests::audit_summary_ignores_non_blocking_plugin_trust_for_triage_rollups ... ok
test browser_companion_diagnostics::tests::observed_version_matches_expected_accepts_exact_tokens ... ok
test audit_cli::tests::audit_summary_ignores_non_blocking_security_scan_for_triage_rollups ... ok
test browser_companion_diagnostics::tests::observed_version_matches_expected_rejects_partial_numeric_matches ... ok
test browser_companion_diagnostics::tests::observed_version_matches_expected_rejects_suffix_variants ... ok
test browser_preview::tests::browser_preview_commands_shell_escape_config_paths ... ok
test channel_send_cli_tests::email_send_cli_accepts_address_target_kind ... ok
test channel_send_cli_tests::email_send_cli_rejects_non_address_target_kind ... ok
test channel_send_cli_tests::email_send_cli_requires_target ... ok
test channel_send_cli_tests::irc_send_cli_accepts_conversation_target_kind ... ok
test channel_send_cli_tests::irc_send_cli_rejects_non_conversation_target_kind ... ok
test channel_send_cli_tests::irc_send_cli_requires_target ... ok
test channel_send_cli_tests::nostr_send_cli_accepts_address_target_kind ... ok
test channel_send_cli_tests::nostr_send_cli_rejects_non_address_target_kind ... ok
test channel_send_cli_tests::twitch_send_cli_accepts_conversation_target_kind ... ok
test channel_send_cli_tests::twitch_send_cli_rejects_non_conversation_target_kind ... ok
test channel_send_cli_tests::twitch_send_cli_requires_target ... ok
test cli_handoff::tests::format_ask_with_config_can_render_legacy_binary_name ... ok
test cli_handoff::tests::format_ask_with_config_shell_quotes_message_content ... ok
test cli_handoff::tests::format_ask_with_config_shell_quotes_the_config_path ... ok
test cli_handoff::tests::format_subcommand_with_config_can_render_legacy_binary_name ... ok
test cli_handoff::tests::format_subcommand_with_config_shell_quotes_the_config_path ... ok
test cli_handoff::tests::shell_quote_argument_escapes_single_quotes ... ok
test command_kind::tests::command_kind_for_logging_uses_stable_variant_names ... ok
test audit_cli::tests::audit_repair_reports_repaired_for_legacy_prefix ... ok
test audit_cli::tests::audit_verify_reports_in_memory_mode_when_journal_is_missing ... ok
test audit_cli::tests::audit_summary_rolls_up_event_kinds_and_last_seen_fields ... ok
test audit_cli::tests::audit_summary_tracks_tool_search_trust_conflict_triage ... ok
test audit_cli::tests::audit_token_trail_filters_token_events_and_summarizes_lifecycle ... ok
test audit_cli::tests::audit_token_trail_reports_truncated_matching_events ... ok
test audit_cli::tests::audit_verify_accepts_legacy_prefix_and_verifies_protected_tail ... ok
test audit_cli::tests::audit_verify_reports_valid_chain_for_fresh_journal ... ok
test audit_cli::tests::audit_verify_reports_first_invalid_line_for_tampered_chain ... ok
test browser_companion_diagnostics::tests::should_probe_browser_companion_via_sh_rejects_non_posix_env_script ... ok
test browser_companion_diagnostics::tests::should_probe_browser_companion_via_sh_accepts_env_sh_script ... ok
test completions_cli::tests::completions_bash_non_empty ... ok
test completions_cli::tests::completions_elvish_non_empty ... ok
test completions_cli::tests::completions_fish_non_empty ... ok
test control_plane_server::tests::control_challenge_returns_nonce_payload ... ok
test completions_cli::tests::completions_powershell_non_empty ... ok
test control_plane_server::tests::control_connect_rejects_protocol_mismatch ... ok
# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.
function __fish_loong_global_optspecs
	string join \n h/help V/version
end

function __fish_loong_needs_command
	# Figure out if the current invocation already has a command.
	set -l cmd (commandline -opc)
	set -e cmd[1]
	argparse -s (__fish_loong_global_optspecs) -- $cmd 2>/dev/null
	or return
	if set -q argv[1]
		# Also print the command, so this can be used to figure out what it is.
		echo $argv[1]
		return 1
	end
	return 0
end

function __fish_loong_using_subcommand
	set -l cmd (__fish_loong_needs_command)
	test -z "$cmd"
	and return 1
	contains -- $cmd[1] $argv
end

complete -c loong -n "__fish_loong_needs_command" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_needs_command" -s V -l version -d 'Print version'
complete -c loong -n "__fish_loong_needs_command" -f -a "demo" -d 'Run the original end-to-end bootstrap demo'
complete -c loong -n "__fish_loong_needs_command" -f -a "run-task" -d 'Deprecated compatibility alias for the generic task runner'
complete -c loong -n "__fish_loong_needs_command" -f -a "turn" -d 'Run agent turns through the unified runtime entry surface'
complete -c loong -n "__fish_loong_needs_command" -f -a "invoke-connector" -d 'Invoke one connector operation through kernel policy gate'
complete -c loong -n "__fish_loong_needs_command" -f -a "audit-demo" -d 'Demonstrate audit lifecycle with fixed clock and token revocation'
complete -c loong -n "__fish_loong_needs_command" -f -a "init-spec" -d 'Generate a runnable JSON spec template for quick vertical customization'
complete -c loong -n "__fish_loong_needs_command" -f -a "run-spec" -d 'Run a full workflow from a JSON spec (task/connector/runtime/tool/memory)'
complete -c loong -n "__fish_loong_needs_command" -f -a "benchmark-programmatic-pressure" -d 'Run pressure benchmarks for programmatic orchestration and optional regression gate checks'
complete -c loong -n "__fish_loong_needs_command" -f -a "benchmark-programmatic-pressure-lint" -d 'Lint pressure baseline coverage without running benchmark scenarios'
complete -c loong -n "__fish_loong_needs_command" -f -a "benchmark-wasm-cache" -d 'Benchmark Wasm compile cache behavior and enforce hot-path speedup gate'
complete -c loong -n "__fish_loong_needs_command" -f -a "benchmark-memory-context" -d 'Benchmark memory prompt-context hydration across window-only, rebuild, steady-state, and shrink catch-up summary paths'
complete -c loong -n "__fish_loong_needs_command" -f -a "validate-config" -d 'Validate config semantics and report structured diagnostics'
complete -c loong -n "__fish_loong_needs_command" -f -a "onboard" -d 'Guided onboarding for fast first-chat setup with preflight diagnostics'
complete -c loong -n "__fish_loong_needs_command" -f -a "personalize" -d 'Capture optional operator preferences for future sessions'
complete -c loong -n "__fish_loong_needs_command" -f -a "doctor" -d 'Run configuration diagnostics and optionally apply safe config/path fixes'
complete -c loong -n "__fish_loong_needs_command" -f -a "audit" -d 'Inspect the retained audit journal through a bounded CLI surface'
complete -c loong -n "__fish_loong_needs_command" -f -a "skills" -d 'Manage installed external skills through an operator-facing CLI surface'
complete -c loong -n "__fish_loong_needs_command" -f -a "tasks" -d 'Manage async background tasks on top of the current session runtime'
complete -c loong -n "__fish_loong_needs_command" -f -a "delegate-child-run"
complete -c loong -n "__fish_loong_needs_command" -f -a "sessions" -d 'Inspect and manage persisted runtime sessions through an operator-facing session shell'
complete -c loong -n "__fish_loong_needs_command" -f -a "status" -d 'Print one operator-readable runtime summary over gateway, ACP, and durable work-unit health'
complete -c loong -n "__fish_loong_needs_command" -f -a "plugins" -d 'Author manifest-first plugin packages and inspect shared plugin governance truth'
complete -c loong -n "__fish_loong_needs_command" -f -a "plugin" -d 'Author manifest-first plugin packages and inspect shared plugin governance truth'
complete -c loong -n "__fish_loong_needs_command" -f -a "channels" -d 'List compiled channel surfaces, aliases, and readiness status'
complete -c loong -n "__fish_loong_needs_command" -f -a "list-models" -d 'Fetch and print currently available provider model list'
complete -c loong -n "__fish_loong_needs_command" -f -a "runtime-snapshot" -d 'Print a unified runtime snapshot for experiment reproducibility and lineage capture'
complete -c loong -n "__fish_loong_needs_command" -f -a "runtime-restore" -d 'Restore a persisted runtime snapshot artifact into the current config and managed skill state'
complete -c loong -n "__fish_loong_needs_command" -f -a "runtime-experiment" -d 'Manage snapshot-linked experiment run records'
complete -c loong -n "__fish_loong_needs_command" -f -a "runtime-capability" -d 'Manage run-derived capability candidates, family readiness, promotion plans, and governed apply outputs'
complete -c loong -n "__fish_loong_needs_command" -f -a "work-unit" -d 'Manage durable work units for long-running runtime orchestration'
complete -c loong -n "__fish_loong_needs_command" -f -a "list-context-engines" -d 'List available conversation context engines and selected runtime engine'
complete -c loong -n "__fish_loong_needs_command" -f -a "list-memory-systems" -d 'List available memory systems and selected runtime memory system'
complete -c loong -n "__fish_loong_needs_command" -f -a "list-mcp-servers" -d 'List configured MCP servers and their runtime-visible inventory state'
complete -c loong -n "__fish_loong_needs_command" -f -a "show-mcp-server" -d 'Show one configured MCP server and its runtime-visible inventory state'
complete -c loong -n "__fish_loong_needs_command" -f -a "list-acp-backends" -d 'List available ACP runtime backends and current control-plane selection'
complete -c loong -n "__fish_loong_needs_command" -f -a "list-acp-sessions" -d 'List persisted ACP session metadata from the local control-plane store'
complete -c loong -n "__fish_loong_needs_command" -f -a "acp-status" -d 'Inspect live ACP session status by session key or conversation identity'
complete -c loong -n "__fish_loong_needs_command" -f -a "acp-observability" -d 'Inspect ACP control-plane observability snapshot from the shared session manager'
complete -c loong -n "__fish_loong_needs_command" -f -a "acp-event-summary" -d 'Print ACP runtime event summary for a conversation session'
complete -c loong -n "__fish_loong_needs_command" -f -a "acp-dispatch" -d 'Evaluate ACP conversation dispatch policy for a session or structured channel address'
complete -c loong -n "__fish_loong_needs_command" -f -a "acp-doctor" -d 'Run ACP backend readiness diagnostics for the selected or requested backend'
complete -c loong -n "__fish_loong_needs_command" -f -a "control-plane-serve" -d 'Run the loopback-only internal control-plane skeleton'
complete -c loong -n "__fish_loong_needs_command" -f -a "chat" -d 'Start interactive CLI chat channel with sliding-window memory'
complete -c loong -n "__fish_loong_needs_command" -f -a "safe-lane-summary" -d 'Print safe-lane runtime event summary for a session'
complete -c loong -n "__fish_loong_needs_command" -f -a "session-search" -d 'Search transcript turns across visible sessions'
complete -c loong -n "__fish_loong_needs_command" -f -a "session-search-inspect" -d 'Inspect one exported session-search artifact'
complete -c loong -n "__fish_loong_needs_command" -f -a "trajectory-export" -d 'Export one session trajectory artifact with transcript turns and session events'
complete -c loong -n "__fish_loong_needs_command" -f -a "trajectory-inspect" -d 'Inspect one exported trajectory artifact'
complete -c loong -n "__fish_loong_needs_command" -f -a "runtime-trajectory" -d 'Export or inspect runtime trajectory artifacts for replay, evaluation, or research workflows'
complete -c loong -n "__fish_loong_needs_command" -f -a "telegram-send" -d 'Send one Telegram message'
complete -c loong -n "__fish_loong_needs_command" -f -a "telegram-serve" -d 'Run Telegram channel polling/response loop'
complete -c loong -n "__fish_loong_needs_command" -f -a "feishu-send" -d 'Send one Feishu message or card'
complete -c loong -n "__fish_loong_needs_command" -f -a "feishu-serve" -d 'Run Feishu event callback server and auto-reply via provider'
complete -c loong -n "__fish_loong_needs_command" -f -a "matrix-send" -d 'Send one Matrix room message'
complete -c loong -n "__fish_loong_needs_command" -f -a "matrix-serve" -d 'Run Matrix sync reply loop'
complete -c loong -n "__fish_loong_needs_command" -f -a "wecom-send" -d 'Send one WeCom AIBot proactive message'
complete -c loong -n "__fish_loong_needs_command" -f -a "wecom-serve" -d 'Run WeCom AIBot long-connection reply loop'
complete -c loong -n "__fish_loong_needs_command" -f -a "whatsapp-serve" -d 'Run WhatsApp Cloud API webhook server and auto-reply via provider'
complete -c loong -n "__fish_loong_needs_command" -f -a "discord-send" -d 'Send one Discord channel message'
complete -c loong -n "__fish_loong_needs_command" -f -a "dingtalk-send" -d 'Send one DingTalk custom robot webhook message'
complete -c loong -n "__fish_loong_needs_command" -f -a "slack-send" -d 'Send one Slack channel message'
complete -c loong -n "__fish_loong_needs_command" -f -a "line-send" -d 'Send one LINE push message'
complete -c loong -n "__fish_loong_needs_command" -f -a "whatsapp-send" -d 'Send one WhatsApp business message'
complete -c loong -n "__fish_loong_needs_command" -f -a "email-send" -d 'Send one SMTP email message'
complete -c loong -n "__fish_loong_needs_command" -f -a "webhook-send" -d 'Send one generic webhook POST message'
complete -c loong -n "__fish_loong_needs_command" -f -a "google-chat-send" -d 'Send one Google Chat incoming webhook message'
complete -c loong -n "__fish_loong_needs_command" -f -a "teams-send" -d 'Send one Microsoft Teams incoming webhook message'
complete -c loong -n "__fish_loong_needs_command" -f -a "tlon-send" -d 'Send one Tlon direct message or group post'
complete -c loong -n "__fish_loong_needs_command" -f -a "signal-send" -d 'Send one Signal direct message'
complete -c loong -n "__fish_loong_needs_command" -f -a "twitch-send" -d 'Send one Twitch chat message'
complete -c loong -n "__fish_loong_needs_command" -f -a "mattermost-send" -d 'Send one Mattermost channel post'
complete -c loong -n "__fish_loong_needs_command" -f -a "nextcloud-talk-send" -d 'Send one Nextcloud Talk bot room message'
complete -c loong -n "__fish_loong_needs_command" -f -a "synology-chat-send" -d 'Send one Synology Chat incoming webhook message'
complete -c loong -n "__fish_loong_needs_command" -f -a "irc-send" -d 'Send one IRC message to a channel or nick'
complete -c loong -n "__fish_loong_needs_command" -f -a "imessage-send" -d 'Send one iMessage chat through BlueBubbles'
complete -c loong -n "__fish_loong_needs_command" -f -a "nostr-send" -d 'Publish one signed Nostr text note'
complete -c loong -n "__fish_loong_needs_command" -f -a "multi-channel-serve" -d 'Run the multi-channel supervisor for coordinated runtime-backed service-channel serving'
complete -c loong -n "__fish_loong_needs_command" -f -a "gateway" -d 'Run the gateway lifecycle namespace'
complete -c loong -n "__fish_loong_needs_command" -f -a "feishu" -d 'Run the Feishu integration namespace'
complete -c loong -n "__fish_loong_needs_command" -f -a "completions" -d 'Print a shell completion script to stdout'
complete -c loong -n "__fish_loong_needs_command" -f -a "welcome" -d 'Show a welcome banner for an already configured install'
complete -c loong -n "__fish_loong_needs_command" -f -a "import" -d 'Preview or apply migration sources explicitly'
complete -c loong -n "__fish_loong_needs_command" -f -a "migrate" -d 'Preview or apply config import modes explicitly'
complete -c loong -n "__fish_loong_needs_command" -f -a "ask" -d 'Run one non-interactive assistant turn'
complete -c loong -n "__fish_loong_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand demo" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand run-task" -l objective -r
complete -c loong -n "__fish_loong_using_subcommand run-task" -l payload -r
complete -c loong -n "__fish_loong_using_subcommand run-task" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand turn; and not __fish_seen_subcommand_from run help" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand turn; and not __fish_seen_subcommand_from run help" -f -a "run" -d 'Run one non-interactive assistant turn through the unified runtime'
complete -c loong -n "__fish_loong_using_subcommand turn; and not __fish_seen_subcommand_from run help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l config -r
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l session -r
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l message -r
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l acp-bootstrap-mcp-server -r
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l acp-cwd -r
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l acp
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -l acp-event-stream
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from run" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from help" -f -a "run" -d 'Run one non-interactive assistant turn through the unified runtime'
complete -c loong -n "__fish_loong_using_subcommand turn; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand invoke-connector" -l operation -r
complete -c loong -n "__fish_loong_using_subcommand invoke-connector" -l payload -r
complete -c loong -n "__fish_loong_using_subcommand invoke-connector" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit-demo" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand init-spec" -l output -r
complete -c loong -n "__fish_loong_using_subcommand init-spec" -l preset -r -f -a "default\t''
plugin-trust-guard\t''"
complete -c loong -n "__fish_loong_using_subcommand init-spec" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l spec -r
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l bridge-support -d 'Optional JSON file containing a bridge support policy override for this spec run' -r
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l bridge-profile -d 'Optional bundled bridge support profile override for this spec run' -r -f -a "native-balanced\t''
openclaw-ecosystem-balanced\t''"
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l bridge-support-delta -d 'Optional delta artifact JSON file derived from a bundled bridge support profile' -r
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l bridge-support-sha256 -d 'Optional sha256 pin for the resolved bridge support policy override' -r
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l bridge-support-delta-sha256 -d 'Optional sha256 pin for the bridge support delta artifact override' -r
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l print-audit
complete -c loong -n "__fish_loong_using_subcommand run-spec" -l render-summary
complete -c loong -n "__fish_loong_using_subcommand run-spec" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure" -l matrix -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure" -l baseline -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure" -l output -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure" -l enforce-gate
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure" -l preflight-fail-on-warnings
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure-lint" -l matrix -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure-lint" -l baseline -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure-lint" -l output -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure-lint" -l enforce-gate
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure-lint" -l fail-on-warnings
complete -c loong -n "__fish_loong_using_subcommand benchmark-programmatic-pressure-lint" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l wasm -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l output -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l cold-iterations -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l hot-iterations -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l warmup-iterations -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l min-speedup-ratio -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -l enforce-gate
complete -c loong -n "__fish_loong_using_subcommand benchmark-wasm-cache" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l output -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l temp-root -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l history-turns -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l sliding-window -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l summary-max-chars -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l words-per-turn -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l rebuild-iterations -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l hot-iterations -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l warmup-iterations -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l suite-repetitions -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l min-steady-state-speedup-ratio -r
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -l enforce-gate
complete -c loong -n "__fish_loong_using_subcommand benchmark-memory-context" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand validate-config" -l config -r
complete -c loong -n "__fish_loong_using_subcommand validate-config" -l output -r -f -a "text\t''
json\t''
problem-json\t''"
complete -c loong -n "__fish_loong_using_subcommand validate-config" -l locale -r
complete -c loong -n "__fish_loong_using_subcommand validate-config" -l json
complete -c loong -n "__fish_loong_using_subcommand validate-config" -l fail-on-diagnostics
complete -c loong -n "__fish_loong_using_subcommand validate-config" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand onboard" -l output -d 'Write the resulting config to a custom path instead of the default loongclaw config location' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l provider -d 'profile id, unique model name or suffix, or provider kind' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l model -d 'Preselect the model to use after the provider choice is resolved' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l api-key -d 'Provider credential environment variable name, for example OPENAI_API_KEY' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l web-search-provider -d 'duckduckgo (or ddg), brave, tavily, perplexity (or perplexity_search), exa, firecrawl, jina (or jinaai / jina-ai)' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l web-search-api-key -d 'Web search credential environment variable name, for example TAVILY_API_KEY' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l personality -d 'Select a native prompt personality in non-interactive mode' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l memory-profile -d 'Select a memory profile in non-interactive mode' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l system-prompt -d 'Preseed the CLI system prompt instead of editing it interactively' -r
complete -c loong -n "__fish_loong_using_subcommand onboard" -l force -d 'Overwrite an existing target config path instead of stopping for manual review'
complete -c loong -n "__fish_loong_using_subcommand onboard" -l non-interactive -d 'Use provided flags only and skip interactive prompts except required safety checks'
complete -c loong -n "__fish_loong_using_subcommand onboard" -l accept-risk -d 'Confirm the onboarding risk acknowledgement in non-interactive mode'
complete -c loong -n "__fish_loong_using_subcommand onboard" -l skip-model-probe -d 'Skip probing the resolved provider model list during onboarding'
complete -c loong -n "__fish_loong_using_subcommand onboard" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c loong -n "__fish_loong_using_subcommand personalize" -l config -d 'Config file path to update (defaults to auto-discovery)' -r
complete -c loong -n "__fish_loong_using_subcommand personalize" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -l config -d 'Config file path to validate (defaults to auto-discovery)' -r
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -l fix -d 'Apply safe auto-fixes for detected diagnostics'
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -l json -d 'Emit machine-readable JSON diagnostics'
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -l skip-model-probe -d 'Skip provider model probing during diagnostics'
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -f -a "security" -d 'Report effective security exposure and config hygiene posture'
complete -c loong -n "__fish_loong_using_subcommand doctor; and not __fish_seen_subcommand_from security help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from security" -l config -d 'Config file path to validate (defaults to auto-discovery)' -r
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from security" -l fix -d 'Apply safe auto-fixes for detected diagnostics'
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from security" -l json -d 'Emit machine-readable JSON diagnostics'
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from security" -l skip-model-probe -d 'Skip provider model probing during diagnostics'
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from security" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from help" -f -a "security" -d 'Report effective security exposure and config hygiene posture'
complete -c loong -n "__fish_loong_using_subcommand doctor; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "recent" -d 'Print the last N retained audit events'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "summary" -d 'Print a compact rollup over the last N retained audit events'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "discovery" -d 'Summarize trust-aware tool discovery events with dedicated trust filters'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "token-trail" -d 'Reconstruct the retained lifecycle for one capability token'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "verify" -d 'Verify the integrity chain of the durable audit journal'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "repair" -d 'Repair legacy journals missing integrity sidecars'
complete -c loong -n "__fish_loong_using_subcommand audit; and not __fish_seen_subcommand_from recent summary discovery token-trail verify repair help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l since-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l until-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l pack-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l agent-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l event-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l token-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l kind -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l triage-label -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l query-contains -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l trust-tier -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from recent" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l since-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l until-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l pack-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l agent-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l event-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l token-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l kind -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l triage-label -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l group-by -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from summary" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l since-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l until-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l pack-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l agent-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l event-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l token-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l triage-label -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l query-contains -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l trust-tier -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l group-by -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from discovery" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l token-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l since-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l until-epoch-s -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l pack-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l agent-id -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from token-trail" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from verify" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from verify" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from verify" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from repair" -l config -r
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from repair" -l json
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from repair" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "recent" -d 'Print the last N retained audit events'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "summary" -d 'Print a compact rollup over the last N retained audit events'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "discovery" -d 'Summarize trust-aware tool discovery events with dedicated trust filters'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "token-trail" -d 'Reconstruct the retained lifecycle for one capability token'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "verify" -d 'Verify the integrity chain of the durable audit journal'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "repair" -d 'Repair legacy journals missing integrity sidecars'
complete -c loong -n "__fish_loong_using_subcommand audit; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "list" -d 'List discovered external skills across managed, user, and project scopes'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "search" -d 'Search the external-skills inventory from a task or capability phrase'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "recommend" -d 'Recommend the best-fit external skills for an operator goal'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "info" -d 'Inspect one resolved external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "inspect" -d 'Inspect one resolved external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "fetch" -d 'Download an external skill package and optionally sync it into the managed runtime'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "install" -d 'Install a managed external skill from a local directory or archive'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "install-bundled" -d 'Install a first-party bundled managed external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "enable-browser-preview" -d 'Enable the managed browser preview flow and install its bundled helper skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "remove" -d 'Remove an installed managed external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "policy" -d 'Inspect or update persisted runtime policy for external skills'
complete -c loong -n "__fish_loong_using_subcommand skills; and not __fish_seen_subcommand_from list search recommend info inspect fetch install install-bundled enable-browser-preview remove policy help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from list" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from list" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from search" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from search" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from search" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from search" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from recommend" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from recommend" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from recommend" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from recommend" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from info" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from info" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from info" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from inspect" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from inspect" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from inspect" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l save-as -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l max-bytes -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l skill-id -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l approve-download
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l install
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l approve-security-once
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l replace
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from fetch" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install" -l skill-id -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install" -l approve-security-once
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install" -l replace
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install-bundled" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install-bundled" -l replace
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install-bundled" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from install-bundled" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from enable-browser-preview" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from enable-browser-preview" -l replace
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from enable-browser-preview" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from enable-browser-preview" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from remove" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from remove" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from remove" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -l config -r
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -l json
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -f -a "get" -d 'Show the persisted external-skills runtime policy'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -f -a "show" -d 'Show the persisted external-skills runtime policy'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -f -a "set" -d 'Persist one or more external-skills runtime policy fields into config'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -f -a "reset" -d 'Reset persisted external-skills policy fields back to config defaults'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from policy" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "list" -d 'List discovered external skills across managed, user, and project scopes'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "search" -d 'Search the external-skills inventory from a task or capability phrase'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "recommend" -d 'Recommend the best-fit external skills for an operator goal'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "info" -d 'Inspect one resolved external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "fetch" -d 'Download an external skill package and optionally sync it into the managed runtime'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "install" -d 'Install a managed external skill from a local directory or archive'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "install-bundled" -d 'Install a first-party bundled managed external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "enable-browser-preview" -d 'Enable the managed browser preview flow and install its bundled helper skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "remove" -d 'Remove an installed managed external skill'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "policy" -d 'Inspect or update persisted runtime policy for external skills'
complete -c loong -n "__fish_loong_using_subcommand skills; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "create" -d 'Queue one async background task on top of the current session runtime'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "list" -d 'List visible async background tasks for the scoped session'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "status" -d 'Inspect one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "info" -d 'Inspect one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "events" -d 'Show recent lifecycle events for one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "wait" -d 'Wait on one visible async background task and return incremental events'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "cancel" -d 'Cancel one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "recover" -d 'Recover one visible overdue async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and not __fish_seen_subcommand_from create list status info events wait cancel recover help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from create" -l label -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from create" -l timeout-seconds -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from create" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from create" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from create" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from create" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l state -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l overdue-only
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l include-archived
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from status" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from status" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from status" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from status" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from info" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from info" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from info" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from info" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from events" -l after-id -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from events" -l limit -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from events" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from events" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from events" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from events" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from wait" -l after-id -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from wait" -l timeout-ms -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from wait" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from wait" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from wait" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from wait" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from cancel" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from cancel" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from cancel" -l dry-run
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from cancel" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from cancel" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from recover" -l config -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from recover" -l session -r
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from recover" -l dry-run
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from recover" -l json
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from recover" -s h -l help -d 'Print help'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "create" -d 'Queue one async background task on top of the current session runtime'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "list" -d 'List visible async background tasks for the scoped session'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "status" -d 'Inspect one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "events" -d 'Show recent lifecycle events for one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "wait" -d 'Wait on one visible async background task and return incremental events'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "cancel" -d 'Cancel one visible async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "recover" -d 'Recover one visible overdue async background task'
complete -c loong -n "__fish_loong_using_subcommand tasks; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or th…
@github-actions github-actions bot added size: L Large pull request: 501-1000 changed lines. and removed size: M Medium pull request: 201-500 changed lines. labels Apr 13, 2026
@chumyin
Copy link
Copy Markdown
Collaborator Author

chumyin commented Apr 13, 2026

Deepening follow-up pushed in f0c722f72.

This round extends the hermetic-home lane in three ways:

  • moves the helper off process-global LOONG_HOME mutation and onto a test-only default_loongclaw_home() override path
  • migrates another default-path slice (config/tools.rs, more tools/runtime_config.rs, and the HOME-rules bash test) onto ScopedLoongClawHome
  • hardens conversation env-override scaffolding against lock-poison cascades and serializes a few high-signal default-dispatcher tests against env-selection interference

Targeted checks after the follow-up all passed locally:

  • cargo fmt --all
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • targeted loongclaw-app --lib checks for tool lease, runtime-home default-path tests, and the previously failing safe-lane/default-dispatcher conversation tests

Important note:

  • cargo test --workspace --locked and the full all-features reruns still expose broader loongclaw-app full-suite contamination around conversation/runtime-global state. The latest failures are no longer the original ambient LOONG_HOME cases; they point at a deeper follow-up lane involving process-sticky runtime config / registry state in the conversation runtime.
  • I have not papered over that with a broad serializing hack in this PR.

@gh-xj
Copy link
Copy Markdown
Collaborator

gh-xj commented Apr 14, 2026

LoongClaw AI scientist has claimed this case and is running review execution.

@gh-xj
Copy link
Copy Markdown
Collaborator

gh-xj commented Apr 14, 2026

LoongClaw QA Review — PR #1237

Reviewed commit: f0c722f
Risk: high
Agent: ai-scientist

Findings

  • high: Full cargo test -p loongclaw-app is still red on this head. handle_turn_with_runtime_safe_lane_executes_session_tools_via_default_dispatcher and handle_turn_with_runtime_safe_lane_executes_session_wait_via_default_dispatcher fail in the full suite even though each passes when filtered alone, so the safe-lane/default-dispatcher lane still has order-dependent contamination — crates/app/src/conversation/tests.rs:25542, crates/app/src/conversation/tests.rs:25722
  • medium: ScopedLoongClawHome only overrides the default home per thread, and the new parallel tool-lease regression test already has to recreate it inside each spawned worker thread. That helper is not a general hermetic-home primitive yet — crates/app/src/config/shared.rs:543, crates/app/src/tools/tool_lease_authority.rs:434

Coverage

  • Rust-specific review: applied (config-default, concurrency, and test-isolation changes)
  • Harness review: applied
  • Adversarial challenge: applied

Open Questions

  • Which remaining global state is leaking into the two safe-lane conversation tests during full-suite execution?
  • GitHub currently reports this branch as CONFLICTING against dev; should the next pass root-cause the suite failure first or rebase first and then re-verify?

Verdict

Blocked: the reviewed head is not merge-ready until the full loongclaw-app crate gate is green and the PR rebases cleanly onto current dev.

gh-xj added 3 commits April 13, 2026 20:30
The failing branch was not blocked by product logic in session tools or delegate
flows. The real defect was test harness coupling: wrapped provider-call tests were
issuing tool leases against whatever default home the process happened to expose,
so parallel runs could invalidate signatures or downgrade app-tool paths into
core `tool.invoke` failures. The delegate announce batch test also mixed a live
background debounce drain with a manual drain, which made the assertion timing
sensitive under load.

This change gives tests a stable default LoongClaw home unless they explicitly
opt into env-based home resolution, keeps explicit env/home overrides working,
and makes the announce batching test deterministic. Narrow direct-binding session
and delegate tests still pin scoped homes where that intent is clearest.

Constraint: CI executes Rust tests in parallel and wrapped provider calls sign leases from runtime-home state
Rejected: Serialize the full suite | hides the shared-state bug and lengthens CI
Rejected: Keep patching individual flaky tests only | leaves the ambient-home hazard in the common harness path
Confidence: high
Scope-risk: narrow
Directive: Tests that depend on home-path semantics should either use `ScopedLoongClawHome` or explicitly set home env vars through `ScopedEnv`; do not rely on the developer machine's ambient HOME
Tested: cargo fmt --all -- --check
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test --workspace
Tested: cargo test --workspace --all-features
Not-tested: merge against current origin/dev
This branch needed the current `dev` baseline to become mergeable again.
The merge itself was mechanically clean except for the tracked April
architecture-drift support artifact, where the correct resolution was to keep
the upstream support-path snapshot while preserving the test-harness hardening
already committed on this branch.

Constraint: PR head was merge-conflicting with current `dev`
Constraint: Release-support drift artifacts were moved and regenerated upstream during the conflict window
Rejected: Rebase before stabilizing the flaky harness | mixed branch drift with test-root-cause work and slowed recovery
Confidence: high
Scope-risk: broad
Directive: The support-path architecture drift artifact is intentionally resolved to the upstream snapshot; regenerate it again only if hotspot inputs change after this merge
Tested: cargo fmt --all -- --check
Tested: git diff --check
Tested: pre-merge cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: pre-merge cargo test --workspace
Tested: pre-merge cargo test --workspace --all-features
Not-tested: full post-merge workspace rerun after resolving the doc-only conflict in docs/releases/support/architecture-drift-2026-04.md
GitHub's pull-request metadata and `refs/pull/1237/head` stayed pinned to
`f0c722f` even after the real branch ref was pushed to `88594172` on the PR
fork. A no-op force push did not trigger refresh, so this empty commit exists
only to force a concrete ref update event for the tracked PR branch.

Constraint: GitHub PR head metadata and pull ref stayed stale after branch push
Rejected: Keep polling only | branch refs were correct but PR state never moved
Rejected: Another no-op force push | confirmed no effect on the stale pull ref
Confidence: medium
Scope-risk: narrow
Directive: Drop this pattern once GitHub acknowledges the real branch tip; do not use empty commits as a normal workflow tool
Tested: GitHub pull ref and branch ref comparison before this commit
Not-tested: code verification (no code changes)
@github-actions github-actions bot removed the documentation Improvements or additions to documentation. label Apr 14, 2026
gh-xj added 2 commits April 13, 2026 21:12
The latest dev tip moved the context-engine and turn-middleware env override
helpers from thread-local test state to mutex-backed state so cross-thread tests
can observe the same override contract. This merge keeps that upstream fix on top
of the branch's ambient-home hardening without reopening the lease-signing
regressions that were already fixed locally.

Constraint: origin/dev advanced after the first merge and overlapped the same test-isolation surfaces
Rejected: Revert the upstream mutex-backed override change | would reintroduce cross-thread blind spots in registry tests
Confidence: high
Scope-risk: narrow
Directive: Keep env override helpers and runtime-home test helpers aligned; mixing thread-local and process-visible assumptions in the same test lane causes nondeterministic failures
Tested: cargo fmt --all -- --check
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test --workspace
Tested: cargo test --workspace --all-features
Not-tested: GitHub Actions rerun after rebasing onto origin/dev@2ebb2666
The latest dev merge and the test-harness stabilization changed the tracked
`tools_mod` footprint enough for the governance freshness gate to fail. This
commit only updates the release-support drift artifact to match the current tree
so the governance workflow and aggregate build gate can go green on the final PR
head.

Constraint: CI fails closed when the tracked monthly architecture drift report is stale
Rejected: Leave the stale artifact and rely on prior green local verification | governance would stay red on the final PR head
Confidence: high
Scope-risk: narrow
Directive: Any follow-up that changes hotspot inputs on this branch must regenerate docs/releases/support/architecture-drift-2026-04.md again before expecting governance to pass
Tested: bash scripts/check_architecture_drift_freshness.sh docs/releases/support/architecture-drift-2026-04.md
Tested: cargo fmt --all -- --check
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test --workspace
Tested: cargo test --workspace --all-features
Not-tested: GitHub Actions rerun after this artifact-only refresh
@github-actions github-actions bot added the documentation Improvements or additions to documentation. label Apr 14, 2026
`origin/dev` advanced again after the earlier merge with a provider/runtime lane
that touched the same conversation announce surface and the tracked April drift
artifact. This commit folds in that newer baseline, keeps the deterministic
announce test shape from upstream, and refreshes the release-support drift report
so the governance gate reflects the actual merged tree.

Constraint: origin/dev advanced again while the PR branch was being stabilized
Constraint: governance fails closed when the tracked monthly drift report is stale
Rejected: Hold the branch on the previous dev merge | GitHub kept the PR in dirty state against the newer base tip
Rejected: Preserve the older manual queue-state seeding in announce tests | upstream now provides a cleaner no-spawn helper for the same deterministic intent
Confidence: high
Scope-risk: broad
Directive: If dev moves again before merge, re-run mergeability and refresh docs/releases/support/architecture-drift-2026-04.md before assuming the branch is still current
Tested: bash scripts/check_architecture_drift_freshness.sh docs/releases/support/architecture-drift-2026-04.md
Tested: cargo fmt --all -- --check
Tested: cargo clippy --workspace --all-targets --all-features -- -D warnings
Tested: cargo test --workspace
Tested: cargo test --workspace --all-features
Not-tested: GitHub Actions rerun after this final dev adoption commit
@gh-xj gh-xj merged commit e374709 into eastreams:dev Apr 14, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Runtime config parsing, schema, and defaults. conversation Conversation runtime, session flow, and prompt assembly. documentation Improvements or additions to documentation. size: L Large pull request: 501-1000 changed lines. tools Tool runtime, policy adapters, and tool catalog behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: runtime-home-sensitive tests still depend on ambient LOONG_HOME

2 participants