pwn 0.5.795 → 0.5.798
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +8 -8
- data/bin/pwn_autoinc_version +4 -5
- data/bin/pwn_web_cache_deception +40 -29
- data/documentation/AWS.md +15 -5
- data/documentation/Diagrams.md +1 -1
- data/documentation/Home.md +2 -2
- data/documentation/How-PWN-Works.md +1 -1
- data/documentation/Mission-Cancellation.md +6 -4
- data/documentation/Operability.md +1 -1
- data/documentation/What-is-PWN.md +1 -1
- data/documentation/diagrams/aws-cloud-security.svg +1 -1
- data/documentation/diagrams/dot/aws-cloud-security.dot +1 -1
- data/documentation/diagrams/dot/network-infra-testing.dot +1 -1
- data/documentation/diagrams/network-infra-testing.svg +1 -1
- data/etc/default_cron/session_cleanup.rb +84 -51
- data/etc/default_skills/pwn/ai/agent/mission_namespace/SKILL.md +6 -4
- data/lib/pwn/ai/agent/assembly.rb +0 -2
- data/lib/pwn/ai/agent/btc.rb +0 -2
- data/lib/pwn/ai/agent/burp_suite.rb +0 -2
- data/lib/pwn/ai/agent/curriculum.rb +2 -2
- data/lib/pwn/ai/agent/dispatch.rb +3 -0
- data/lib/pwn/ai/agent/engagement.rb +96 -41
- data/lib/pwn/ai/agent/extrospection/osint/bridges.rb +2 -0
- data/lib/pwn/ai/agent/extrospection.rb +50 -13
- data/lib/pwn/ai/agent/gqrx.rb +0 -2
- data/lib/pwn/ai/agent/hacker_one.rb +0 -2
- data/lib/pwn/ai/agent/learning.rb +45 -13
- data/lib/pwn/ai/agent/loop.rb +16 -11
- data/lib/pwn/ai/agent/metrics.rb +1 -1
- data/lib/pwn/ai/agent/mission.rb +6 -3
- data/lib/pwn/ai/agent/mission_namespace.rb +70 -14
- data/lib/pwn/ai/agent/policy.rb +1 -1
- data/lib/pwn/ai/agent/policy_evaluation.rb +2 -2
- data/lib/pwn/ai/agent/reflect.rb +1 -0
- data/lib/pwn/ai/agent/request_runtime.rb +1 -1
- data/lib/pwn/ai/agent/reward.rb +155 -53
- data/lib/pwn/ai/agent/sast.rb +0 -2
- data/lib/pwn/ai/agent/task_dag.rb +5 -3
- data/lib/pwn/ai/agent/task_summarizer.rb +21 -11
- data/lib/pwn/ai/agent/tool_guard.rb +19 -0
- data/lib/pwn/ai/agent/tools/ruby_eval.rb +1 -1
- data/lib/pwn/ai/agent/tools/verify.rb +7 -3
- data/lib/pwn/ai/agent/transparent_browser.rb +0 -2
- data/lib/pwn/ai/agent/turn_finalizer.rb +3 -0
- data/lib/pwn/ai/anthropic.rb +3 -3
- data/lib/pwn/ai/context.rb +2 -1
- data/lib/pwn/ai/gemini.rb +7 -5
- data/lib/pwn/ai/grok.rb +37 -18
- data/lib/pwn/ai/mcp.rb +17 -5
- data/lib/pwn/ai/ollama.rb +76 -35
- data/lib/pwn/ai/open_ai.rb +7 -19
- data/lib/pwn/ai/open_web_ui.rb +76 -40
- data/lib/pwn/aws/cloud_search_domain.rb +6 -0
- data/lib/pwn/aws/iam.rb +2 -2
- data/lib/pwn/aws/workspaces.rb +2 -2
- data/lib/pwn/aws.rb +0 -5
- data/lib/pwn/bounty/lifecycle_authz_replay.rb +1 -1
- data/lib/pwn/config.rb +17 -10
- data/lib/pwn/corpus.rb +33 -5
- data/lib/pwn/cron.rb +60 -17
- data/lib/pwn/driver.rb +2 -3
- data/lib/pwn/engagement.rb +28 -10
- data/lib/pwn/ffi/capstone.rb +3 -2
- data/lib/pwn/ffi/fftw.rb +8 -6
- data/lib/pwn/ffi/keystone.rb +3 -2
- data/lib/pwn/ffi/soapy_sdr.rb +10 -6
- data/lib/pwn/json_text.rb +25 -13
- data/lib/pwn/memory_index.rb +6 -4
- data/lib/pwn/module_skills.rb +3 -1
- data/lib/pwn/plugins/aflplusplus.rb +1 -0
- data/lib/pwn/plugins/ai_sandbox.rb +42 -10
- data/lib/pwn/plugins/android.rb +429 -466
- data/lib/pwn/plugins/artifact_registry.rb +12 -2
- data/lib/pwn/plugins/assembly.rb +9 -42
- data/lib/pwn/plugins/authentication_helper.rb +4 -3
- data/lib/pwn/plugins/baresip.rb +70 -28
- data/lib/pwn/plugins/binary_analysis.rb +14 -5
- data/lib/pwn/plugins/binary_parser.rb +42 -7
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +3 -3
- data/lib/pwn/plugins/burp_suite.rb +15 -12
- data/lib/pwn/plugins/bus_pirate.rb +3 -7
- data/lib/pwn/plugins/char.rb +9 -3
- data/lib/pwn/plugins/credit_card.rb +7 -0
- data/lib/pwn/plugins/dao_ldap.rb +2 -2
- data/lib/pwn/plugins/dao_mongo.rb +1 -1
- data/lib/pwn/plugins/debugger.rb +1 -1
- data/lib/pwn/plugins/defect_dojo.rb +7 -3
- data/lib/pwn/plugins/detect_os.rb +1 -1
- data/lib/pwn/plugins/detonate.rb +9 -19
- data/lib/pwn/plugins/exploit_db.rb +1 -1
- data/lib/pwn/plugins/file_fu.rb +4 -1
- data/lib/pwn/plugins/findings.rb +76 -2
- data/lib/pwn/plugins/fuzz.rb +12 -3
- data/lib/pwn/plugins/gdb.rb +7 -2
- data/lib/pwn/plugins/gdbmi.rb +10 -6
- data/lib/pwn/plugins/git.rb +18 -13
- data/lib/pwn/plugins/github.rb +11 -6
- data/lib/pwn/plugins/google_workspace.rb +11 -3
- data/lib/pwn/plugins/hacker_one.rb +5 -1
- data/lib/pwn/plugins/httpx.rb +24 -8
- data/lib/pwn/plugins/ip_info.rb +11 -8
- data/lib/pwn/plugins/irc.rb +73 -45
- data/lib/pwn/plugins/jenkins.rb +2 -2
- data/lib/pwn/plugins/jira_data_center.rb +13 -6
- data/lib/pwn/plugins/jobs.rb +62 -4
- data/lib/pwn/plugins/log.rb +1 -1
- data/lib/pwn/plugins/monkey_patch.rb +1 -1
- data/lib/pwn/plugins/msr206.rb +157 -182
- data/lib/pwn/plugins/nessus_cloud.rb +2 -2
- data/lib/pwn/plugins/nexpose_vuln_scan.rb +44 -33
- data/lib/pwn/plugins/nuclei.rb +24 -8
- data/lib/pwn/plugins/ocr.rb +3 -1
- data/lib/pwn/plugins/open_api.rb +0 -4
- data/lib/pwn/plugins/openvas.rb +31 -43
- data/lib/pwn/plugins/packet.rb +40 -25
- data/lib/pwn/plugins/pony.rb +2 -2
- data/lib/pwn/plugins/preflight_checker.rb +1 -1
- data/lib/pwn/plugins/process_tube.rb +17 -2
- data/lib/pwn/plugins/ps.rb +6 -1
- data/lib/pwn/plugins/pwn_logger.rb +37 -1
- data/lib/pwn/plugins/repl/ai.rb +1 -0
- data/lib/pwn/plugins/repl/ai_console.rb +18 -6
- data/lib/pwn/plugins/repl/mesh.rb +51 -28
- data/lib/pwn/plugins/sbom.rb +59 -27
- data/lib/pwn/plugins/scannable_codes.rb +3 -1
- data/lib/pwn/plugins/serial.rb +102 -44
- data/lib/pwn/plugins/shodan.rb +4 -10
- data/lib/pwn/plugins/sock.rb +16 -11
- data/lib/pwn/plugins/ssn.rb +3 -1
- data/lib/pwn/plugins/transparent_browser.rb +43 -3
- data/lib/pwn/plugins/vault.rb +92 -30
- data/lib/pwn/plugins/vin.rb +2 -1
- data/lib/pwn/plugins/vsphere.rb +2 -1
- data/lib/pwn/plugins/xxd.rb +3 -5
- data/lib/pwn/plugins/yubikey/security_domain/scp.rb +4 -0
- data/lib/pwn/plugins/yubikey/transport.rb +42 -11
- data/lib/pwn/plugins/yubikey.rb +21 -6
- data/lib/pwn/plugins/zaproxy.rb +3 -4
- data/lib/pwn/reports/ai_red_team.rb +4 -4
- data/lib/pwn/reports/pdf.rb +9 -5
- data/lib/pwn/reports/sast.rb +4 -4
- data/lib/pwn/sast/keystore.rb +2 -2
- data/lib/pwn/sast/logger.rb +1 -1
- data/lib/pwn/sast/php_type_juggling.rb +3 -6
- data/lib/pwn/sast/pom_version.rb +12 -6
- data/lib/pwn/sast/port.rb +1 -1
- data/lib/pwn/sast/sql.rb +3 -7
- data/lib/pwn/sast/test_case_engine.rb +62 -16
- data/lib/pwn/sast/type_script_type_juggling.rb +3 -6
- data/lib/pwn/sdr/decoder/base.rb +8 -0
- data/lib/pwn/sdr/decoder/lora.rb +1 -1
- data/lib/pwn/sdr/flipper_zero.rb +4 -7
- data/lib/pwn/sdr/gqrx.rb +35 -16
- data/lib/pwn/sdr/son_micro_rfid.rb +44 -26
- data/lib/pwn/sdr.rb +1 -1
- data/lib/pwn/session_trace.rb +7 -2
- data/lib/pwn/sessions.rb +310 -41
- data/lib/pwn/setup.rb +4 -3
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn/www/app_cobalt_io.rb +14 -2
- data/lib/pwn/www/bing.rb +13 -1
- data/lib/pwn/www/bug_crowd.rb +14 -2
- data/lib/pwn/www/checkip.rb +13 -1
- data/lib/pwn/www/coinbase_pro.rb +14 -2
- data/lib/pwn/www/duckduckgo.rb +13 -1
- data/lib/pwn/www/facebook.rb +14 -2
- data/lib/pwn/www/github.rb +14 -2
- data/lib/pwn/www/google.rb +13 -1
- data/lib/pwn/www/hacker_one.rb +117 -33
- data/lib/pwn/www/linkedin.rb +14 -2
- data/lib/pwn/www/pandora.rb +14 -2
- data/lib/pwn/www/pastebin.rb +13 -1
- data/lib/pwn/www/paypal.rb +16 -4
- data/lib/pwn/www/synack.rb +14 -2
- data/lib/pwn/www/torch.rb +17 -3
- data/lib/pwn/www/trading_view.rb +14 -2
- data/lib/pwn/www/twitter.rb +14 -2
- data/lib/pwn/www/uber.rb +14 -2
- data/lib/pwn/www/upwork.rb +14 -2
- data/lib/pwn/www/wayback_machine.rb +16 -2
- data/lib/pwn/www/youtube.rb +13 -1
- data/lib/pwn.rb +11 -0
- data/pwn.gemspec +4 -0
- data/spec/conventions_spec.rb +43 -0
- data/spec/integration/authentication_helper_oath_spec.rb +1 -1
- data/spec/integration/autoinc_lifecycle_supplement_spec.rb +47 -0
- data/spec/integration/gemspec_deleted_files_spec.rb +43 -0
- data/spec/integration/harness_evaluation_spec.rb +22 -31
- data/spec/integration/harness_live_spec.rb +8 -18
- data/spec/integration/spec_curriculum_isolation_spec.rb +41 -0
- data/spec/integration/verify_acceptance_eui_regression_spec.rb +162 -0
- data/spec/integration/web_cache_lifecycle_closure_spec.rb +89 -0
- data/spec/integration/web_cache_lifecycle_supplement_spec.rb +70 -0
- data/spec/lib/pwn/ai/agent/analysis_errors_regression_spec.rb +33 -0
- data/spec/lib/pwn/ai/agent/curriculum_cooldown_regression_spec.rb +19 -0
- data/spec/lib/pwn/ai/agent/curriculum_spec.rb +2 -0
- data/spec/lib/pwn/ai/agent/engagement_boundary_regression_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/engagement_dispatch_review_spec.rb +82 -0
- data/spec/lib/pwn/ai/agent/engagement_roe_regression_spec.rb +25 -0
- data/spec/lib/pwn/ai/agent/engagement_scope_regression_spec.rb +37 -0
- data/spec/lib/pwn/ai/agent/extrospection/osint/bridges_spec.rb +4 -0
- data/spec/lib/pwn/ai/agent/extrospection_input_regression_spec.rb +31 -0
- data/spec/lib/pwn/ai/agent/extrospection_review_spec.rb +61 -0
- data/spec/lib/pwn/ai/agent/extrospection_serial_review_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/extrospection_spec.rb +9 -0
- data/spec/lib/pwn/ai/agent/extrospection_verification_regression_spec.rb +39 -0
- data/spec/lib/pwn/ai/agent/learning_last_answer_regression_spec.rb +32 -0
- data/spec/lib/pwn/ai/agent/learning_lifecycle_closure_spec.rb +84 -0
- data/spec/lib/pwn/ai/agent/learning_prune_regression_spec.rb +17 -0
- data/spec/lib/pwn/ai/agent/learning_spec.rb +2 -1
- data/spec/lib/pwn/ai/agent/loop_execution_audit_spec.rb +30 -0
- data/spec/lib/pwn/ai/agent/metrics_usage_regression_spec.rb +20 -0
- data/spec/lib/pwn/ai/agent/mission_execution_audit_spec.rb +27 -0
- data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +218 -18
- data/spec/lib/pwn/ai/agent/policy_confidence_regression_spec.rb +16 -0
- data/spec/lib/pwn/ai/agent/policy_evaluation_spec.rb +1 -1
- data/spec/lib/pwn/ai/agent/policy_evaluation_tmp_regression_spec.rb +36 -0
- data/spec/lib/pwn/ai/agent/reflect_model_regression_spec.rb +15 -0
- data/spec/lib/pwn/ai/agent/request_runtime_execution_audit_spec.rb +43 -0
- data/spec/lib/pwn/ai/agent/reward_binding_review_spec.rb +129 -0
- data/spec/lib/pwn/ai/agent/reward_dispatch_review_spec.rb +154 -0
- data/spec/lib/pwn/ai/agent/reward_envelope_regression_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/reward_turn_regression_spec.rb +40 -0
- data/spec/lib/pwn/ai/agent/swarm_spec.rb +2 -2
- data/spec/lib/pwn/ai/agent/task_dag_execution_audit_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/task_summarizer_failure_regression_spec.rb +26 -0
- data/spec/lib/pwn/ai/agent/tools/verify_execution_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/context_range_audit_spec.rb +24 -0
- data/spec/lib/pwn/ai/gemini_roundtrip_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/grok_reasoning_effort_spec.rb +43 -0
- data/spec/lib/pwn/ai/mcp_session_audit_spec.rb +36 -0
- data/spec/lib/pwn/ai/ollama_spec.rb +6 -11
- data/spec/lib/pwn/ai/open_web_ui_spec.rb +6 -11
- data/spec/lib/pwn/ai/provider_history_audit_spec.rb +44 -0
- data/spec/lib/pwn/ai/provider_operations_audit_spec.rb +53 -0
- data/spec/lib/pwn/ai/provider_review_history_stream_regression_spec.rb +143 -0
- data/spec/lib/pwn/ai/provider_review_tls_regression_spec.rb +62 -0
- data/spec/lib/pwn/ai/provider_stream_audit_spec.rb +49 -0
- data/spec/lib/pwn/aws/iam_decoding_regression_spec.rb +23 -0
- data/spec/lib/pwn/aws/services_runtime_regression_spec.rb +51 -0
- data/spec/lib/pwn/aws_spec.rb +6 -0
- data/spec/lib/pwn/banner_operational_audit_spec.rb +105 -0
- data/spec/lib/pwn/bounty/lifecycle_authz_replay_spec.rb +17 -0
- data/spec/lib/pwn/config_redaction_regression_spec.rb +24 -0
- data/spec/lib/pwn/config_skills_regression_spec.rb +38 -0
- data/spec/lib/pwn/corpus_core_review_regression_spec.rb +96 -0
- data/spec/lib/pwn/corpus_spec.rb +13 -0
- data/spec/lib/pwn/cron_core_review_regression_spec.rb +95 -0
- data/spec/lib/pwn/cron_execution_spec.rb +75 -0
- data/spec/lib/pwn/driver_core_review_regression_spec.rb +38 -0
- data/spec/lib/pwn/driver_spec.rb +13 -0
- data/spec/lib/pwn/engagement_core_review_regression_spec.rb +88 -0
- data/spec/lib/pwn/engagement_storage_regression_spec.rb +44 -0
- data/spec/lib/pwn/ffi/capstone_spec.rb +19 -0
- data/spec/lib/pwn/ffi/fftw_spec.rb +19 -0
- data/spec/lib/pwn/ffi/keystone_spec.rb +13 -0
- data/spec/lib/pwn/ffi/soapy_sdr_spec.rb +13 -0
- data/spec/lib/pwn/json_schemer_regexp_parser_spec.rb +12 -0
- data/spec/lib/pwn/json_text_spec.rb +25 -0
- data/spec/lib/pwn/memory_index_spec.rb +23 -0
- data/spec/lib/pwn/module_skills_parsing_regression_spec.rb +34 -0
- data/spec/lib/pwn/module_skills_spec.rb +11 -1
- data/spec/lib/pwn/plugins/ai_sandbox_boundary_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/ai_sandbox_spec.rb +10 -18
- data/spec/lib/pwn/plugins/android_review_fixes_spec.rb +121 -0
- data/spec/lib/pwn/plugins/android_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/api_import_namespace_audit_spec.rb +49 -0
- data/spec/lib/pwn/plugins/artifact_registry_namespace_audit_spec.rb +20 -0
- data/spec/lib/pwn/plugins/artifact_registry_review_fixes_spec.rb +63 -0
- data/spec/lib/pwn/plugins/assembly_namespace_audit_spec.rb +16 -0
- data/spec/lib/pwn/plugins/assembly_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/authentication_helper_spec.rb +14 -0
- data/spec/lib/pwn/plugins/baresip_review_fixes_spec.rb +127 -0
- data/spec/lib/pwn/plugins/baresip_transport_audit_spec.rb +59 -0
- data/spec/lib/pwn/plugins/binary_analysis_process_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/black_duck_namespace_audit_spec.rb +25 -0
- data/spec/lib/pwn/plugins/burp_suite_har_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/plugins/burp_suite_import_review_fixes_spec.rb +62 -0
- data/spec/lib/pwn/plugins/burp_suite_namespace_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/bus_pirate_transport_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/file_fu_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/findings_structured_spec.rb +1 -1
- data/spec/lib/pwn/plugins/gdbmi_namespace_audit_spec.rb +28 -0
- data/spec/lib/pwn/plugins/gdbmi_review_fixes_spec.rb +73 -0
- data/spec/lib/pwn/plugins/github_argv_review_spec.rb +49 -0
- data/spec/lib/pwn/plugins/google_workspace_provider_review_oauth_spec.rb +80 -0
- data/spec/lib/pwn/plugins/irc_review_fixes_spec.rb +92 -0
- data/spec/lib/pwn/plugins/irc_transport_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/jenkins_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/jira_data_center_namespace_audit_spec.rb +44 -0
- data/spec/lib/pwn/plugins/jira_data_center_review_fixes_spec.rb +81 -0
- data/spec/lib/pwn/plugins/jsonl_elf_review_fixes_spec.rb +59 -0
- data/spec/lib/pwn/plugins/log_spec.rb +36 -20
- data/spec/lib/pwn/plugins/monkey_patch_spec.rb +16 -0
- data/spec/lib/pwn/plugins/msr206_readback_review_fixes_spec.rb +119 -0
- data/spec/lib/pwn/plugins/msr206_review_fixes_spec.rb +50 -0
- data/spec/lib/pwn/plugins/msr206_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/nessus_cloud_namespace_audit_spec.rb +14 -0
- data/spec/lib/pwn/plugins/nexpose_review_fixes_spec.rb +55 -0
- data/spec/lib/pwn/plugins/open_api_namespace_audit_spec.rb +22 -0
- data/spec/lib/pwn/plugins/packet_transport_audit_spec.rb +47 -0
- data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +600 -0
- data/spec/lib/pwn/plugins/pony_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/pony_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/process_tube_namespace_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/ps_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/pwn_logger_spec.rb +30 -0
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +127 -0
- data/spec/lib/pwn/plugins/repl/ai_spec.rb +38 -0
- data/spec/lib/pwn/plugins/repl/mesh_spec.rb +52 -0
- data/spec/lib/pwn/plugins/repl_mesh_rx_errors_spec.rb +18 -0
- data/spec/lib/pwn/plugins/sandbox_spec.rb +9 -7
- data/spec/lib/pwn/plugins/sbom_review_fixes_spec.rb +43 -0
- data/spec/lib/pwn/plugins/scannable_codes_namespace_audit_spec.rb +15 -0
- data/spec/lib/pwn/plugins/serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/plugins/serial_transport_audit_spec.rb +102 -0
- data/spec/lib/pwn/plugins/shodan_namespace_audit_spec.rb +10 -0
- data/spec/lib/pwn/plugins/sock_transport_audit_spec.rb +55 -0
- data/spec/lib/pwn/plugins/transparent_browser_navigation_review_spec.rb +21 -0
- data/spec/lib/pwn/plugins/vault_master_key_eui_regression_spec.rb +242 -0
- data/spec/lib/pwn/plugins/vault_spec.rb +58 -0
- data/spec/lib/pwn/plugins/vault_store_safety_spec.rb +1 -1
- data/spec/lib/pwn/plugins/xxd_namespace_audit_spec.rb +34 -0
- data/spec/lib/pwn/plugins/yubikey_hid_cleanup_review_fixes_spec.rb +52 -0
- data/spec/lib/pwn/plugins/yubikey_lifecycle_audit_spec.rb +65 -0
- data/spec/lib/pwn/plugins/yubikey_options_audit_spec.rb +30 -0
- data/spec/lib/pwn/plugins/yubikey_selector_audit_spec.rb +26 -0
- data/spec/lib/pwn/plugins/yubikey_spec.rb +1 -1
- data/spec/lib/pwn/plugins/zaproxy_namespace_audit_spec.rb +30 -0
- data/spec/lib/pwn/reports/empty_report_audit_spec.rb +18 -0
- data/spec/lib/pwn/reports/pdf_spec.rb +25 -0
- data/spec/lib/pwn/reports/provider_review_encoding_regression_spec.rb +35 -0
- data/spec/lib/pwn/sast/engine_runtime_regression_spec.rb +91 -0
- data/spec/lib/pwn/sast/filter_edge_regression_spec.rb +39 -0
- data/spec/lib/pwn/sast/formatter_review_fixes_spec.rb +178 -0
- data/spec/lib/pwn/sast/path_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/sast/pom_runtime_regression_spec.rb +37 -0
- data/spec/lib/pwn/sast/rules_runtime_regression_spec.rb +78 -0
- data/spec/lib/pwn/sast/sql_review_fixes_spec.rb +38 -0
- data/spec/lib/pwn/sdr/decoder/base_iq_spec.rb +21 -18
- data/spec/lib/pwn/sdr/decoder/base_review_fixes_spec.rb +49 -0
- data/spec/lib/pwn/sdr/decoder/base_validation_spec.rb +78 -0
- data/spec/lib/pwn/sdr/decoder/lora_spec.rb +9 -0
- data/spec/lib/pwn/sdr/flipper_zero_review_fixes_spec.rb +34 -0
- data/spec/lib/pwn/sdr/gqrx_operational_spec.rb +83 -0
- data/spec/lib/pwn/sdr/gqrx_review_fixes_spec.rb +22 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_review_fixes_spec.rb +113 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_spec.rb +39 -0
- data/spec/lib/pwn/sdr_spec.rb +5 -0
- data/spec/lib/pwn/session_cleanup_concurrency_spec.rb +21 -0
- data/spec/lib/pwn/session_cleanup_default_spec.rb +1 -1
- data/spec/lib/pwn/session_cleanup_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/session_cleanup_payload_spec.rb +3 -2
- data/spec/lib/pwn/session_trace_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/sessions_archive_closure_spec.rb +126 -0
- data/spec/lib/pwn/sessions_lifecycle_closure_spec.rb +373 -0
- data/spec/lib/pwn/sessions_lifecycle_supplement_spec.rb +204 -0
- data/spec/lib/pwn/setup_operational_regression_spec.rb +36 -0
- data/spec/lib/pwn/www/browser_review_fixes_spec.rb +70 -0
- data/spec/lib/pwn/www/browser_runtime_regression_spec.rb +100 -0
- data/spec/lib/pwn/www/hacker_one_runtime_regression_spec.rb +146 -0
- data/spec/lib/pwn/www/pagination_review_fixes_spec.rb +84 -0
- data/spec/spec_helper.rb +34 -5
- data/spec/support/namespace_controller_observability_fixture.rb +141 -0
- data/spec/support/sandbox.rb +8 -5
- data/third_party/pwn_rdoc.jsonl +83 -32
- metadata +7690 -7386
- data/etc/default_skills/pwn/aws/elastic_transcoder/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/lambda_preview/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works_cm/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/sms/SKILL.md +0 -48
- data/lib/pwn/aws/elastic_transcoder.rb +0 -95
- data/lib/pwn/aws/lambda_preview.rb +0 -95
- data/lib/pwn/aws/ops_works.rb +0 -95
- data/lib/pwn/aws/ops_works_cm.rb +0 -95
- data/lib/pwn/aws/sms.rb +0 -95
- data/spec/lib/pwn/aws/elastic_transcoder_spec.rb +0 -15
- data/spec/lib/pwn/aws/lambda_preview_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_cm_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_spec.rb +0 -15
- data/spec/lib/pwn/aws/sms_spec.rb +0 -15
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::AI::Agent::Extrospection, 'canonical verification review' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
allow(described_class).to receive(:tls_fingerprint).and_return([nil, nil])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def serve_html(html, status = 200)
|
|
14
|
+
response = double('offline HTTP response', body: html, code: status, headers: {})
|
|
15
|
+
browser = double('offline HTTP client')
|
|
16
|
+
allow(browser).to receive(:get).and_yield(response, nil, nil)
|
|
17
|
+
allow(described_class).to receive(:with_headless_browser).and_yield(type: :rest, browser: browser)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
[
|
|
21
|
+
'<title>Maintenance</title><p>Temporarily unavailable; retry later.</p>',
|
|
22
|
+
'<title>CVE-2026-12345</title><p>Please sign in to continue.</p>',
|
|
23
|
+
'<h1>CVE-2026-12345</h1><p>Checking your browser before accessing the record.</p>',
|
|
24
|
+
'<h1>CVE-2026-54321</h1><h2>Description</h2><p>Synthetic product contains a memory safety flaw.</p>',
|
|
25
|
+
'<h1>CVE-2026-12345</h1><p>Details</p>',
|
|
26
|
+
'<title>Maintenance</title><h1>CVE-2026-12345</h1><h2>Description</h2><p>Service is undergoing planned maintenance.</p>'
|
|
27
|
+
].each do |html|
|
|
28
|
+
it "keeps noncanonical 200 content unknown: #{html}" do
|
|
29
|
+
serve_html(html)
|
|
30
|
+
expect(described_class.verify(claim: 'CVE-2026-12345', commit: false)).to include(verdict: :unknown, confidence: 0.0)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'persists unavailable-source decisions as unknown with evidence provenance' do
|
|
35
|
+
serve_html('<title>Unavailable</title><p>Offline fixture</p>', 503)
|
|
36
|
+
result = described_class.verify(claim: 'CVE-2026-12345', commit: true)
|
|
37
|
+
expect(result).to include(verdict: :unknown, action_taken: :learning_note)
|
|
38
|
+
learning = PWN::AI::Agent::Learning
|
|
39
|
+
expect(learning.outcomes(success: false)).to be_empty
|
|
40
|
+
expect(learning.outcomes(success: true)).to be_empty
|
|
41
|
+
row = learning.outcomes.first
|
|
42
|
+
expect(row).to include(success: nil, verdict: 'unknown', training_score: nil, decision_version: 1, status: 'unverified')
|
|
43
|
+
expect(row.dig(:grounded, :evidence).map { |page| page[:status] }).to eq([503, 503])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'persists an unknown decision when the browser source itself is unavailable' do
|
|
47
|
+
allow(described_class).to receive(:with_headless_browser).and_raise(IOError, 'offline browser unavailable')
|
|
48
|
+
result = described_class.verify(claim: 'CVE-2026-12345', commit: true)
|
|
49
|
+
expect(result).to include(verdict: :unknown, action_taken: :learning_note)
|
|
50
|
+
row = PWN::AI::Agent::Learning.outcomes.first
|
|
51
|
+
expect(row).to include(training_score: nil, status: 'unverified', verdict: 'unknown')
|
|
52
|
+
expect(PWN::AI::Agent::Learning.outcomes(success: false)).to be_empty
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'confirms record identity only when canonical description content exists' do
|
|
56
|
+
serve_html('<h1>CVE-2026-12345</h1><h2>Description</h2><p data-testid="vuln-description">Synthetic fixture product contains a memory safety flaw.</p>')
|
|
57
|
+
result = described_class.verify(claim: 'CVE-2026-12345', commit: false)
|
|
58
|
+
expect(result).to include(verdict: :confirmed)
|
|
59
|
+
expect(result[:evidence].map { |row| row[:dom_sha] }).to all(match(/\A[0-9a-f]{16}\z/))
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'timeout'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::AI::Agent::Extrospection, 'serial buffer ownership' do
|
|
7
|
+
include_context 'pwn tmp sandbox'
|
|
8
|
+
|
|
9
|
+
it 'senses its own connection while preserving another live session buffer' do
|
|
10
|
+
serial = PWN::Plugins::Serial
|
|
11
|
+
first_reader, first_writer = IO.pipe
|
|
12
|
+
second_reader, second_writer = IO.pipe
|
|
13
|
+
first_path = File.join(@tmp, 'first-serial-fixture')
|
|
14
|
+
second_path = File.join(@tmp, 'second-serial-fixture')
|
|
15
|
+
[first_path, second_path].each { |path| File.write(path, '') }
|
|
16
|
+
allow(UART).to receive(:open).with(first_path, 9600, '8N1').and_return(first_reader)
|
|
17
|
+
allow(UART).to receive(:open).with(second_path, 9600, '8N1').and_return(second_reader)
|
|
18
|
+
allow(second_reader).to receive(:ioctl).and_return(0)
|
|
19
|
+
allow(Termios).to receive(:tcgetattr).with(second_reader).and_return(double('attributes', ospeed: Termios::B9600, cflag: Termios::CS8))
|
|
20
|
+
first = serial.connect(block_dev: first_path)
|
|
21
|
+
first_writer.write('first-buffer')
|
|
22
|
+
Timeout.timeout(2) { Thread.pass until serial.dump_session_data(serial_obj: first).join == 'first-buffer' }
|
|
23
|
+
second = nil
|
|
24
|
+
allow(serial).to receive(:connect).and_wrap_original do |original, opts|
|
|
25
|
+
second = original.call(opts)
|
|
26
|
+
end
|
|
27
|
+
allow(described_class).to receive(:probe_serial).and_return([])
|
|
28
|
+
allow(described_class).to receive(:sleep) do
|
|
29
|
+
second_writer.write('second-buffer')
|
|
30
|
+
Timeout.timeout(2) { Thread.pass until serial.dump_session_data(serial_obj: second).join == 'second-buffer' }
|
|
31
|
+
end
|
|
32
|
+
result = described_class.serial_sense(block_dev: second_path, settle_secs: 0.2, record: false)
|
|
33
|
+
expect(result).to include(ok: true, text: 'second-buffer')
|
|
34
|
+
expect(serial.dump_session_data(serial_obj: first).join).to eq('first-buffer')
|
|
35
|
+
expect(first_reader).not_to be_closed
|
|
36
|
+
expect(second_reader).to be_closed
|
|
37
|
+
ensure
|
|
38
|
+
serial.disconnect(serial_obj: first) if first
|
|
39
|
+
serial.disconnect(serial_obj: second) if second
|
|
40
|
+
[first_reader, first_writer, second_reader, second_writer].compact.each { |io| io.close unless io.closed? }
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
4
5
|
|
|
5
6
|
describe PWN::AI::Agent::Extrospection do
|
|
7
|
+
include_context 'pwn tmp sandbox'
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(RestClient::Request).to receive(:execute).and_raise(IOError, 'offline fixture')
|
|
11
|
+
allow(PWN::Plugins::VIN).to receive(:decode_vin).and_raise(IOError, 'offline fixture')
|
|
12
|
+
allow(described_class).to receive(:sh).and_return('')
|
|
13
|
+
end
|
|
14
|
+
|
|
6
15
|
it 'should display information for authors' do
|
|
7
16
|
authors_response = PWN::AI::Agent::Extrospection
|
|
8
17
|
expect(authors_response).to respond_to :authors
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Extrospection, 'unavailable verification sources' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(described_class).to receive(:with_headless_browser).and_yield(:offline_browser)
|
|
10
|
+
expect(PWN::AI::Agent::Mistakes).not_to receive(:record)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
[nil, { reachable: false, status: 0, text: '' }, { reachable: false, status: 503, text: 'Service unavailable' }, { reachable: true, status: 200, text: '' }].each do |page|
|
|
14
|
+
it "does not label a CVE confirmed or refuted from #{page.inspect}" do
|
|
15
|
+
allow(described_class).to receive(:fingerprint_page) { page&.dup }
|
|
16
|
+
result = described_class.verify(claim: 'CVE-2026-12345', kind: :cve, commit: false)
|
|
17
|
+
expect(result).to include(verdict: :unknown, confidence: 0.0)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "does not refute a document claim from #{page.inspect}" do
|
|
21
|
+
allow(described_class).to receive(:fingerprint_page) { page&.dup }
|
|
22
|
+
result = described_class.verify(claim: 'fixture documentation explains syntax', url: 'https://example.test/docs', commit: false)
|
|
23
|
+
expect(result).to include(verdict: :unknown, confidence: 0.0)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'still confirms a CVE using reachable source text' do
|
|
28
|
+
allow(described_class).to receive(:fingerprint_page) do |opts|
|
|
29
|
+
{ reachable: true, status: 200, url: opts[:url], text: 'CVE-2026-12345 Description: Synthetic fixture product contains a memory safety flaw.' }
|
|
30
|
+
end
|
|
31
|
+
expect(described_class.verify(claim: 'CVE-2026-12345', commit: false)).to include(verdict: :confirmed)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'still refutes a missing document from an explicit not-found response' do
|
|
35
|
+
allow(described_class).to receive(:fingerprint_page) { { reachable: false, status: 404, text: 'Not found' } }
|
|
36
|
+
result = described_class.verify(claim: 'fixture documentation', url: 'https://example.test/missing', commit: false)
|
|
37
|
+
expect(result).to include(verdict: :refuted)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe 'last-assistant learning paths' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
let(:transcript) do
|
|
9
|
+
[
|
|
10
|
+
{ role: 'user', content: 'first task' },
|
|
11
|
+
{ role: 'assistant', content: 'older answer' },
|
|
12
|
+
{ role: 'user', content: 'second task' },
|
|
13
|
+
{ role: 'assistant', content: 'latest answer' },
|
|
14
|
+
{ role: 'user', content: 'no, that is wrong' }
|
|
15
|
+
]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
before do
|
|
19
|
+
allow(PWN::Sessions).to receive(:load).with(session_id: 'fixture-session').and_return(transcript)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'extracts the latest answer for provider-free reflection without mutating the transcript' do
|
|
23
|
+
result = PWN::AI::Agent::Learning.reflect(session_id: 'fixture-session', dry_run: true)
|
|
24
|
+
expect(result[:lessons].map { |row| row[:lesson] }).to eq(['Approach that worked: latest answer'])
|
|
25
|
+
expect(transcript.last[:role]).to eq('user')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'retains the actual rejected answer for correction preference capture' do
|
|
29
|
+
PWN::AI::Agent::Mistakes.check_user_correction(request: 'no, that is wrong', session_id: 'fixture-session')
|
|
30
|
+
expect(Thread.current[:pwn_pending_pref]).to include(prompt: 'second task', rejected: 'latest answer')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::AI::Agent::Learning, 'lifecycle publication compatibility' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
root = File.join(@tmp, '.pwn')
|
|
11
|
+
FileUtils.mkdir_p(root)
|
|
12
|
+
stub_const('PWN::Sessions::SESSIONS_DIR', File.join(root, 'sessions'))
|
|
13
|
+
stub_const('PWN::AI::Agent::Learning::LEARNING_FILE', File.join(root, 'learning.jsonl'))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
[false, true].each do |dry|
|
|
17
|
+
['{unparseable evidence', '[1,2]'].each do |invalid|
|
|
18
|
+
it "AI-LR-L07 preserves uncertain evidence and reports a blocked #{dry ? 'preview' : 'apply'} for #{invalid}" do
|
|
19
|
+
good = JSON.generate(id: 'good', task: 'retained task', success: false, details: 'fixture', timestamp: '2020-01-01T00:00:00Z')
|
|
20
|
+
bytes = "#{good}\n#{invalid}\n"
|
|
21
|
+
File.write(described_class::LEARNING_FILE, bytes)
|
|
22
|
+
inode = File.stat(described_class::LEARNING_FILE).ino
|
|
23
|
+
result = described_class.prune_outcomes!(dry_run: dry)
|
|
24
|
+
expect(File.binread(described_class::LEARNING_FILE)).to eq(bytes.b)
|
|
25
|
+
expect(File.stat(described_class::LEARNING_FILE).ino).to eq(inode)
|
|
26
|
+
expect(result).to include(state: 'blocked', aborted: true, malformed_rows: 1, removed: 0, kept: 2)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'binds archived PRM publication to the original turn through the actual Reward caller' do
|
|
32
|
+
session = PWN::Sessions.create
|
|
33
|
+
PWN::Sessions.append(session_id: session[:id], role: 'user', content: 'first request')
|
|
34
|
+
PWN::Sessions.append(session_id: session[:id], role: 'tool', content: 'first tool')
|
|
35
|
+
snapshot = PWN::AI::Agent::Reward.prm_snapshot(session_id: session[:id], request: 'first request')
|
|
36
|
+
PWN::Sessions.append(session_id: session[:id], role: 'user', content: 'later request')
|
|
37
|
+
PWN::Sessions.append(session_id: session[:id], role: 'tool', content: 'later tool')
|
|
38
|
+
described_class.note_outcome(task: 'retained evidence', success: false, session_id: session[:id])
|
|
39
|
+
described_class.migrate_evidence(dry_run: false)
|
|
40
|
+
original_row = described_class.outcomes.first
|
|
41
|
+
PWN::Sessions.delete(session_id: session[:id], force: true)
|
|
42
|
+
result = PWN::AI::Agent::Reward.send(:annotate_session, session_id: session[:id], rewards: [1], binding: snapshot[:binding])
|
|
43
|
+
expect(result).to include(annotated: true, binding_sha256: Digest::SHA256.hexdigest(JSON.generate(snapshot[:binding])))
|
|
44
|
+
expect(PWN::Sessions.load(session_id: session[:id]).select { |row| row[:role] == 'tool' }.map { |row| row[:step_reward] }).to eq([1, nil])
|
|
45
|
+
expect(described_class.evidence_transcript(row: original_row).select { |row| row[:role] == 'tool' }.map { |row| row[:step_reward] }).to eq([nil, nil])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'rejects a stale archived PRM binding before any index or snapshot publication' do
|
|
49
|
+
session = PWN::Sessions.create
|
|
50
|
+
PWN::Sessions.append(session_id: session[:id], role: 'user', content: 'request')
|
|
51
|
+
PWN::Sessions.append(session_id: session[:id], role: 'tool', content: 'tool')
|
|
52
|
+
binding = PWN::AI::Agent::Reward.prm_snapshot(session_id: session[:id], request: 'request')[:binding].merge(prefix_sha256: 'f' * 64)
|
|
53
|
+
described_class.note_outcome(task: 'retained evidence', success: false, session_id: session[:id])
|
|
54
|
+
described_class.migrate_evidence(dry_run: false)
|
|
55
|
+
PWN::Sessions.delete(session_id: session[:id], force: true)
|
|
56
|
+
before = File.binread(described_class::LEARNING_FILE)
|
|
57
|
+
result = described_class.annotate_evidence(session_id: session[:id], rewards: [1], binding: binding)
|
|
58
|
+
expect(result).to include(annotated: false, reason: :stale_binding)
|
|
59
|
+
expect(File.binread(described_class::LEARNING_FILE)).to eq(before)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'preserves opaque manual identifiers without inventing a source transcript' do
|
|
63
|
+
row = described_class.note_outcome(task: 'manual assessment', session_id: 'sess-p20-hi', success: false)
|
|
64
|
+
expect(row[:session_id]).to eq('sess-p20-hi')
|
|
65
|
+
expect(File).not_to exist(File.join(PWN::Sessions::SESSIONS_DIR, 'sess-p20-hi.jsonl'))
|
|
66
|
+
expect(described_class.outcomes.first[:session_id]).to eq('sess-p20-hi')
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'binds a new canonical outcome to verified archived evidence after source deletion' do
|
|
70
|
+
session = PWN::Sessions.create
|
|
71
|
+
described_class.note_outcome(task: 'initial assessment', session_id: session[:id], success: false)
|
|
72
|
+
described_class.migrate_evidence(dry_run: false)
|
|
73
|
+
expected = described_class.session_evidence(session_id: session[:id])
|
|
74
|
+
PWN::Sessions.delete(session_id: session[:id], force: true)
|
|
75
|
+
row = described_class.note_outcome(task: 'offline reassessment', session_id: session[:id], success: false)
|
|
76
|
+
expect(described_class.evidence_transcript(row: row)).to eq(expected)
|
|
77
|
+
expect(described_class.evidence_complete?(row: row)).to be(true)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it 'rejects missing canonical evidence without publishing a dangling reference' do
|
|
81
|
+
expect { described_class.note_outcome(task: 'missing source', session_id: '20000101_000000_aabbccdd', success: false) }.to raise_error(IOError)
|
|
82
|
+
expect(described_class.outcomes).to eq([])
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Learning, 'pruning accounting' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
it 'counts a duplicate only once in removed outcomes' do
|
|
9
|
+
rows = 3.times.map do |index|
|
|
10
|
+
{ id: "fixture-#{index}", task: 'same task', success: false, details: '', timestamp: '2020-01-01T00:00:00Z' }
|
|
11
|
+
end
|
|
12
|
+
File.write(described_class::LEARNING_FILE, "#{rows.map { |row| JSON.generate(row) }.join("\n")}\n")
|
|
13
|
+
result = described_class.prune_outcomes!
|
|
14
|
+
expect(result).to include(kept: 1, removed: 2, deduped: 2)
|
|
15
|
+
expect(described_class.outcomes.length).to eq(1)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -203,7 +203,8 @@ describe PWN::AI::Agent::Learning do
|
|
|
203
203
|
old_row = JSON.parse(before, symbolize_names: true)
|
|
204
204
|
File.delete(@source)
|
|
205
205
|
expect(PWN::AI::Agent::Reward).to receive(:fold_step_reward_to_metrics).with(content: 'support tool', reward: 1)
|
|
206
|
-
PWN::AI::Agent::Reward.
|
|
206
|
+
binding = PWN::AI::Agent::Reward.prm_snapshot(session_id: @sid, request: @trace.find { |row| row[:role] == 'user' }[:content])[:binding]
|
|
207
|
+
PWN::AI::Agent::Reward.send(:annotate_session, session_id: @sid, rewards: [1], binding: binding)
|
|
207
208
|
trace = PWN::Sessions.load(session_id: @sid)
|
|
208
209
|
expect(trace.find { |row| row[:role] == 'tool' }[:step_reward]).to eq(1)
|
|
209
210
|
expect(trace.map { |row| row[:content] }).to eq(@trace.map { |row| row[:content] })
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::AI::Agent::Loop, 'previous-session recall persistence' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'reads the previous transcript without appending the current conversation to it' do
|
|
13
|
+
previous = PWN::Sessions.create(id: 'previous-recall', title: 'Previous recall fixture')
|
|
14
|
+
PWN::Sessions.append(session_id: previous[:id], role: 'user', content: 'Keep the release notes concise.')
|
|
15
|
+
PWN::Sessions.append(session_id: previous[:id], role: 'assistant', content: 'I recorded that preference.')
|
|
16
|
+
current = PWN::Sessions.create(id: 'current-recall', title: 'Current recall fixture')
|
|
17
|
+
previous_path = File.join(PWN::Sessions.sessions_dir, "#{previous[:id]}.jsonl")
|
|
18
|
+
old_bytes = File.binread(previous_path)
|
|
19
|
+
request = 'what did I just say in the last session?'
|
|
20
|
+
expect(PWN::AI::Ollama).not_to receive(:chat_with_tools)
|
|
21
|
+
|
|
22
|
+
answer = described_class.run(request: request, session_id: current[:id], system_role_content: 'Recall fixture')
|
|
23
|
+
|
|
24
|
+
expect(answer).to include('Keep the release notes concise.')
|
|
25
|
+
expect(File.binread(previous_path)).to eq(old_bytes)
|
|
26
|
+
turns = PWN::Sessions.load(session_id: current[:id]).last(2)
|
|
27
|
+
expect(turns.map { |row| row[:role].to_s }).to eq(%w[user assistant])
|
|
28
|
+
expect(turns.map { |row| row[:content] }).to eq([request, answer])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::Metrics, 'persisted model usage' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
it 'accumulates repeated model calls after the JSON key roundtrip' do
|
|
9
|
+
described_class.record_tokens(model: 'fixture-model', tokens: 10, cost: 0.1)
|
|
10
|
+
described_class.record_tokens(model: 'fixture-model', tokens: 20, cost: 0.2)
|
|
11
|
+
described_class.record_tokens(model: 'other-model', tokens: 7, cost: 0.0)
|
|
12
|
+
usage = described_class.usage
|
|
13
|
+
expect(usage).to include(tokens: 37, calls: 3)
|
|
14
|
+
expect(usage[:by_model][:'fixture-model']).to include(tokens: 30, calls: 2)
|
|
15
|
+
expect(usage[:by_model][:'fixture-model'][:cost]).to be_within(0.000001).of(0.3)
|
|
16
|
+
expect(usage[:by_model][:'other-model']).to include(tokens: 7, calls: 1)
|
|
17
|
+
raw = JSON.parse(File.read(described_class::METRICS_FILE))
|
|
18
|
+
expect(raw['usage']['by_model'].keys).to contain_exactly('fixture-model', 'other-model')
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::AI::Agent::Mission, 'failed DAG resume accounting' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'keeps a failed resumed step out of completed-step state and the operator report' do
|
|
13
|
+
steps = [{ id: 'probe', tool: 'shell', args: { command: 'exit 7', timeout: 5 } }]
|
|
14
|
+
dag = PWN::AI::Agent::TaskDAG.plan(request: 'probe status', steps: steps)
|
|
15
|
+
PWN::AI::Agent::TaskDAG.execute(dag: dag, root: @tmp, run_id: 'failed-resume')
|
|
16
|
+
described_class.begin!(id: 'probe', request: 'probe status')
|
|
17
|
+
described_class.bind_run!(id: 'probe', run_id: 'failed-resume', root: @tmp)
|
|
18
|
+
|
|
19
|
+
report = described_class.resume_run(id: 'probe')
|
|
20
|
+
|
|
21
|
+
expect(report[:ok]).to be false
|
|
22
|
+
expect(described_class.current(id: 'probe')[:last_completed_step]).to be_nil
|
|
23
|
+
expect(described_class.done?(id: 'probe')).to be false
|
|
24
|
+
expect(report[:text]).not_to include('Completed steps: probe')
|
|
25
|
+
expect(report[:text]).to include('Failed steps: probe')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -4,11 +4,207 @@ require 'spec_helper'
|
|
|
4
4
|
require 'open3'
|
|
5
5
|
require 'tmpdir'
|
|
6
6
|
|
|
7
|
+
RSpec.describe PwnSpecNamespaceControllerFixture do
|
|
8
|
+
it 'restores the prior subreaper setting even when a fixture fails' do
|
|
9
|
+
prctl = PWN::AI::Agent::MissionNamespace.native('prctl', [Fiddle::TYPE_INT, Fiddle::TYPE_LONG, Fiddle::TYPE_LONG, Fiddle::TYPE_LONG, Fiddle::TYPE_LONG])
|
|
10
|
+
setting = lambda do
|
|
11
|
+
value = [0].pack('i')
|
|
12
|
+
expect(prctl.call(37, Fiddle::Pointer[value].to_i, 0, 0, 0)).to eq(0)
|
|
13
|
+
value.unpack1('i')
|
|
14
|
+
end
|
|
15
|
+
previous = setting.call
|
|
16
|
+
expect do
|
|
17
|
+
described_class.with_reaping do
|
|
18
|
+
expect(setting.call).to eq(1)
|
|
19
|
+
raise 'synthetic fixture failure'
|
|
20
|
+
end
|
|
21
|
+
end.to raise_error(RuntimeError, 'synthetic fixture failure')
|
|
22
|
+
expect(setting.call).to eq(previous)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'reaps only the adopted controller children after controller death' do
|
|
26
|
+
described_class.with_reaping do
|
|
27
|
+
Dir.mktmpdir('mission-adoption-') do |root|
|
|
28
|
+
ready = File.join(root, 'ready')
|
|
29
|
+
release, sender = IO.pipe
|
|
30
|
+
unrelated = Process.fork do
|
|
31
|
+
sender.close
|
|
32
|
+
release.read(1)
|
|
33
|
+
exit! 41
|
|
34
|
+
end
|
|
35
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new) do
|
|
36
|
+
child = Process.fork do
|
|
37
|
+
sender.close
|
|
38
|
+
release.read(1)
|
|
39
|
+
exit! 0
|
|
40
|
+
end
|
|
41
|
+
File.write("#{ready}.new", child.to_s)
|
|
42
|
+
File.rename("#{ready}.new", ready)
|
|
43
|
+
nil
|
|
44
|
+
end
|
|
45
|
+
owner = described_class.new(descriptor: {})
|
|
46
|
+
release.close
|
|
47
|
+
owner.wait_ready(ready)
|
|
48
|
+
child = Integer(File.read(ready))
|
|
49
|
+
owner.terminate
|
|
50
|
+
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
51
|
+
expect { owner.wait_ready(File.join(root, 'never-ready')) }.to raise_error(described_class::StartupError, /class=unavailable.*termsig=9/)
|
|
52
|
+
expect(Process.clock_gettime(Process::CLOCK_MONOTONIC) - started).to be < 2
|
|
53
|
+
# The adopted child still holds the diagnostic writer until released.
|
|
54
|
+
sender.write('11')
|
|
55
|
+
sender.close
|
|
56
|
+
owner.close
|
|
57
|
+
expect(owner.status.termsig).to eq(Signal.list.fetch('KILL'))
|
|
58
|
+
expect { Process.waitpid(child, Process::WNOHANG) }.to raise_error(Errno::ECHILD)
|
|
59
|
+
_, unrelated_status = Process.wait2(unrelated)
|
|
60
|
+
expect(unrelated_status.exitstatus).to eq(41)
|
|
61
|
+
ensure
|
|
62
|
+
sender.write('11') if sender && !sender.closed?
|
|
63
|
+
owner&.close
|
|
64
|
+
[release, sender].compact.each { |io| io.close unless io.closed? }
|
|
65
|
+
[child, unrelated].compact.each do |pid|
|
|
66
|
+
Process.waitpid(pid)
|
|
67
|
+
rescue Errno::ECHILD
|
|
68
|
+
nil
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
[0, 73].each do |exit_status|
|
|
75
|
+
it "detects owner exit #{exit_status} before readiness even without an IPC report" do
|
|
76
|
+
Dir.mktmpdir('mission-early-exit-') do |root|
|
|
77
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new) { exit! exit_status }
|
|
78
|
+
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
79
|
+
owner = described_class.new(descriptor: {})
|
|
80
|
+
pid = owner.pid
|
|
81
|
+
expect { owner.wait_ready(File.join(root, 'never-ready')) }.to raise_error(described_class::StartupError, /class=unavailable.*exitstatus=#{exit_status}/)
|
|
82
|
+
expect(Process.clock_gettime(Process::CLOCK_MONOTONIC) - started).to be < 2
|
|
83
|
+
expect(owner.status.exitstatus).to eq(exit_status)
|
|
84
|
+
expect { Process.waitpid(pid, Process::WNOHANG) }.to raise_error(Errno::ECHILD)
|
|
85
|
+
ensure
|
|
86
|
+
owner&.close
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'preserves a constructor SystemExit status rather than replacing it in ensure' do
|
|
92
|
+
Dir.mktmpdir('mission-system-exit-') do |root|
|
|
93
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new) { exit 73 }
|
|
94
|
+
owner = described_class.new(descriptor: {})
|
|
95
|
+
expect { owner.wait_ready(File.join(root, 'never-ready')) }.to raise_error(described_class::StartupError, /class=SystemExit.*exitstatus=73/)
|
|
96
|
+
ensure
|
|
97
|
+
owner&.close
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'keeps the ten-second payload deadline when the constructor returns without readiness' do
|
|
102
|
+
Dir.mktmpdir('mission-no-marker-') do |root|
|
|
103
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new).and_return(nil)
|
|
104
|
+
expect(Timeout).to receive(:timeout).with(10).and_call_original
|
|
105
|
+
owner = described_class.new(descriptor: {})
|
|
106
|
+
pid = owner.pid
|
|
107
|
+
expect { owner.wait_ready(File.join(root, 'never-ready')) }.to raise_error(Timeout::Error)
|
|
108
|
+
owner.close
|
|
109
|
+
expect(owner.status.termsig).to eq(Signal.list.fetch('KILL'))
|
|
110
|
+
expect { Process.waitpid(pid, Process::WNOHANG) }.to raise_error(Errno::ECHILD)
|
|
111
|
+
ensure
|
|
112
|
+
owner&.close
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it 'closes both diagnostic descriptors and does not signal an already reaped owner' do
|
|
117
|
+
pipes = []
|
|
118
|
+
allow(IO).to receive(:pipe).and_wrap_original do |original|
|
|
119
|
+
original.call.tap { |pair| pipes.concat(pair) }
|
|
120
|
+
end
|
|
121
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new) { exit! 73 }
|
|
122
|
+
owner = described_class.new(descriptor: {})
|
|
123
|
+
expect(pipes.reject(&:closed?)).to all(be_close_on_exec)
|
|
124
|
+
Process.waitpid(owner.pid)
|
|
125
|
+
expect(Process).not_to receive(:kill)
|
|
126
|
+
owner.close
|
|
127
|
+
owner.close
|
|
128
|
+
expect(pipes.length).to eq(2)
|
|
129
|
+
expect(pipes).to all(be_closed)
|
|
130
|
+
ensure
|
|
131
|
+
owner&.close
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
[0, -1].each do |invalid_pid|
|
|
135
|
+
it "never signals or waits on an invalid fork PID #{invalid_pid}" do
|
|
136
|
+
pipes = []
|
|
137
|
+
allow(IO).to receive(:pipe).and_wrap_original do |original|
|
|
138
|
+
original.call.tap { |pair| pipes.concat(pair) }
|
|
139
|
+
end
|
|
140
|
+
allow(Process).to receive(:fork).and_return(invalid_pid)
|
|
141
|
+
expect(Process).not_to receive(:kill)
|
|
142
|
+
expect(Process).not_to receive(:wait2)
|
|
143
|
+
expect { described_class.new(descriptor: {}) }.to raise_error(ArgumentError, /positive child PID/)
|
|
144
|
+
expect(pipes.length).to eq(2)
|
|
145
|
+
expect(pipes).to all(be_closed)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'reaps safely when the owner disappears during the child snapshot' do
|
|
150
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new).and_return(nil)
|
|
151
|
+
owner = described_class.new(descriptor: {})
|
|
152
|
+
pid = owner.pid
|
|
153
|
+
allow(File).to receive(:read).and_call_original
|
|
154
|
+
allow(File).to receive(:read).with("/proc/#{pid}/task/#{pid}/children") do
|
|
155
|
+
Process.kill('KILL', pid)
|
|
156
|
+
Process.waitpid(pid)
|
|
157
|
+
raise Errno::ENOENT, 'synthetic concurrent owner reap'
|
|
158
|
+
end
|
|
159
|
+
expect { owner.close }.not_to raise_error
|
|
160
|
+
expect(owner.pid).to be_nil
|
|
161
|
+
ensure
|
|
162
|
+
owner&.close
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'closes both diagnostic descriptors if fork fails' do
|
|
166
|
+
pipes = []
|
|
167
|
+
allow(IO).to receive(:pipe).and_wrap_original do |original|
|
|
168
|
+
original.call.tap { |pair| pipes.concat(pair) }
|
|
169
|
+
end
|
|
170
|
+
allow(Process).to receive(:fork).and_raise(Errno::EAGAIN)
|
|
171
|
+
expect(Process).not_to receive(:kill)
|
|
172
|
+
expect { described_class.new(descriptor: {}) }.to raise_error(Errno::EAGAIN)
|
|
173
|
+
expect(pipes).to all(be_closed)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
it 'propagates an early synthetic constructor failure promptly with safe evidence' do
|
|
177
|
+
Dir.mktmpdir('mission-startup-error-') do |root|
|
|
178
|
+
secret = 'synthetic-private-config=DO-NOT-REPORT'
|
|
179
|
+
allow(PWN::AI::Agent::MissionNamespace).to receive(:new) do
|
|
180
|
+
raise PWN::AI::Agent::MissionNamespace::Unavailable, secret
|
|
181
|
+
end
|
|
182
|
+
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
183
|
+
owner = described_class.new(descriptor: { operation: :command, argv: ['/bin/true'] })
|
|
184
|
+
pid = owner.pid
|
|
185
|
+
expect { owner.wait_ready(File.join(root, 'never-ready')) }.to raise_error(described_class::StartupError) { |error|
|
|
186
|
+
expect(error.message).to include('PWN::AI::Agent::MissionNamespace::Unavailable', 'exitstatus=1')
|
|
187
|
+
expect(error.message).to match(/location=mission_namespace_spec\.rb:\d+/)
|
|
188
|
+
expect(error.message).not_to include(secret, root, '/opt/pwn', 'argv')
|
|
189
|
+
}
|
|
190
|
+
expect(Process.clock_gettime(Process::CLOCK_MONOTONIC) - started).to be < 2
|
|
191
|
+
expect(owner.status.exitstatus).to eq(1)
|
|
192
|
+
expect { Process.waitpid(pid, Process::WNOHANG) }.to raise_error(Errno::ECHILD)
|
|
193
|
+
ensure
|
|
194
|
+
owner&.close
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
7
199
|
RSpec.describe 'PWN::AI::Agent::MissionNamespace compiler-free process ownership' do
|
|
8
200
|
around do |example|
|
|
9
201
|
previous = PWN::AI::Agent::MissionNamespace.force_exec
|
|
10
202
|
PWN::AI::Agent::MissionNamespace.force_exec = true
|
|
11
|
-
example.
|
|
203
|
+
if example.metadata[:controller_fixture]
|
|
204
|
+
PwnSpecNamespaceControllerFixture.with_reaping { example.run }
|
|
205
|
+
else
|
|
206
|
+
example.run
|
|
207
|
+
end
|
|
12
208
|
ensure
|
|
13
209
|
PWN::AI::Agent::MissionNamespace.force_exec = previous
|
|
14
210
|
end
|
|
@@ -47,6 +243,14 @@ RSpec.describe 'PWN::AI::Agent::MissionNamespace compiler-free process ownership
|
|
|
47
243
|
expect(restored[:time].utc_offset).to eq(value[:time].utc_offset)
|
|
48
244
|
end
|
|
49
245
|
|
|
246
|
+
it 'starts a command without a user namespace' do
|
|
247
|
+
mission = PWN::AI::Agent::MissionNamespace.new(descriptor: { operation: :command, argv: ['/bin/true'] }, containment: :host)
|
|
248
|
+
expect(mission.wait).to eq(:reaped)
|
|
249
|
+
expect(mission.status.success?).to be(true)
|
|
250
|
+
ensure
|
|
251
|
+
mission&.close
|
|
252
|
+
end
|
|
253
|
+
|
|
50
254
|
it 'preserves the exit status of a failed mission' do
|
|
51
255
|
mission = PWN::AI::Agent::MissionNamespace.new(descriptor: { operation: :command, argv: [RbConfig.ruby, '-e', 'exit! 73'] })
|
|
52
256
|
mission.wait
|
|
@@ -55,29 +259,25 @@ RSpec.describe 'PWN::AI::Agent::MissionNamespace compiler-free process ownership
|
|
|
55
259
|
mission&.close
|
|
56
260
|
end
|
|
57
261
|
|
|
58
|
-
it 'terminates owned descendants when the controller dies' do
|
|
262
|
+
it 'terminates owned descendants when the controller dies', :controller_fixture do
|
|
59
263
|
Dir.mktmpdir('mission-owner-') do |root|
|
|
60
264
|
ready = File.join(root, 'ready')
|
|
61
265
|
late = File.join(root, 'late')
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Process.kill('KILL', owner)
|
|
72
|
-
Process.wait(owner)
|
|
73
|
-
owner = nil
|
|
266
|
+
code = "Process.setsid; File.write(ARGV[0], 'ready'); sleep 1; File.write(ARGV[1], 'late')"
|
|
267
|
+
owner = PwnSpecNamespaceControllerFixture.new(descriptor: { operation: :command, argv: [RbConfig.ruby, '-e', code, ready, late] })
|
|
268
|
+
owner.wait_ready(ready)
|
|
269
|
+
supervisors = File.read("/proc/#{owner.pid}/task/#{owner.pid}/children").split.map { |value| Integer(value, 10) }
|
|
270
|
+
expect(supervisors.length).to eq(1)
|
|
271
|
+
expect(supervisors).to all(be > 1)
|
|
272
|
+
expect(Process).to receive(:kill).with('KILL', owner.pid).once.and_call_original
|
|
273
|
+
owner.terminate
|
|
274
|
+
expect(owner.status.termsig).to eq(Signal.list.fetch('KILL'))
|
|
74
275
|
sleep 1.2
|
|
75
276
|
expect(File.exist?(late)).to be(false)
|
|
277
|
+
owner.close
|
|
278
|
+
supervisors.each { |pid| expect { Process.waitpid(pid, Process::WNOHANG) }.to raise_error(Errno::ECHILD) }
|
|
76
279
|
ensure
|
|
77
|
-
|
|
78
|
-
Process.kill('KILL', owner)
|
|
79
|
-
Process.wait(owner)
|
|
80
|
-
end
|
|
280
|
+
owner&.close
|
|
81
281
|
end
|
|
82
282
|
end
|
|
83
283
|
|