cross-backend-porting-EXPERIMENTAL - #3
Conversation
…u ↔ mini-swe-agent)
Add hdp.engine.port: a pre-flight coverage audit() and a port() operation
chaining lift → audit → generate, refusing to generate on a blocking gap and
always writing an honest coverage report (hdp_port_coverage.json) beside the
ported harness.
- port/{coverage.py,__init__.py,__main__.py}: CapabilityIssue/CoverageReport,
audit(), port(), PortResult, PortCoverageError, CLI. Scope: nexau ↔
mini-swe-agent (openharness intentionally excluded via the _SUPPORTED gate).
- adapters/base.py: no-op capability_issues() default.
- adapters/nexau.py + mini_swe_agent.py: capability_issues() detecting blocking
(policy/verifier + unresolvable-in-dest tool binding), collision (nexau
system_rules/same-scope memory), silent_drop (mini-swe unrecognized
system_rules id); _reject_unsupported routed through it, raising only
policy/verifier so the existing ValueError-on-binding path is byte-identical.
- run.py: subcommand + cmd_port; configs/hdp/port-example.yaml.
- tests: test_port.py + test_port_coverage.py (12 -zsh tests, no LLM/E2B).
Corrects two brief premises verified against the code: openharness raises (not
silently drops) on unrecognized system_rules ids, and no adapter can resolve
another's tool binding (every real-seed cross-port is binding-blocked) — the
latter surfaced as a blocking capability issue rather than a raw ValueError.
)
There was a problem hiding this comment.
2 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="hdp/engine/run.py">
<violation number="1" location="hdp/engine/run.py:154">
P2: Config-driven port runs can unexpectedly allow partial generation when `allow_partial` is supplied via `${ENV}` as `false`, because `bool('false')` evaluates to `True`. Consider parsing string booleans explicitly before passing this into `port_harness`, so blocking coverage gaps still refuse by default.</violation>
</file>
<file name="hdp/engine/port/coverage.py">
<violation number="1" location="hdp/engine/port/coverage.py:28">
P2: The `severity` field on `CapabilityIssue` is typed as `str` but documented and universally used as one of three exact values (`"blocking"`, `"silent_drop"`, `"collision"`). The project already uses `Literal` for this pattern (`ChangeKind = Literal["added", "removed", "modified"]` in `differ.py`). Using `Literal["blocking", "silent_drop", "collision"]` would catch typos at type-check time and keep the codebase consistent.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| harness_path = port_cfg.get("harness", hdp_cfg.get("harness", "agents/code_agent_simple")) | ||
| source_target = port_cfg.get("source_target", "nexau") | ||
| dest_target = port_cfg.get("dest_target", "mini-swe-agent") | ||
| allow_partial = bool(port_cfg.get("allow_partial", False)) |
There was a problem hiding this comment.
P2: Config-driven port runs can unexpectedly allow partial generation when allow_partial is supplied via ${ENV} as false, because bool('false') evaluates to True. Consider parsing string booleans explicitly before passing this into port_harness, so blocking coverage gaps still refuse by default.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At hdp/engine/run.py, line 154:
<comment>Config-driven port runs can unexpectedly allow partial generation when `allow_partial` is supplied via `${ENV}` as `false`, because `bool('false')` evaluates to `True`. Consider parsing string booleans explicitly before passing this into `port_harness`, so blocking coverage gaps still refuse by default.</comment>
<file context>
@@ -140,6 +140,42 @@ def cmd_gen(cfg: dict) -> int:
+ harness_path = port_cfg.get("harness", hdp_cfg.get("harness", "agents/code_agent_simple"))
+ source_target = port_cfg.get("source_target", "nexau")
+ dest_target = port_cfg.get("dest_target", "mini-swe-agent")
+ allow_partial = bool(port_cfg.get("allow_partial", False))
+ arm = (cfg.get("run") or {}).get("arm", "treatment")
+ seed = int((cfg.get("run") or {}).get("seed", 0))
</file context>
| allow_partial = bool(port_cfg.get("allow_partial", False)) | |
| raw_allow_partial = port_cfg.get("allow_partial", False) | |
| allow_partial = (raw_allow_partial.strip().lower() in {"1", "true", "yes", "on"} | |
| if isinstance(raw_allow_partial, str) else bool(raw_allow_partial)) |
| component_id: str | ||
| layer: str | ||
| type: str | ||
| severity: str # "blocking" | "silent_drop" | "collision" |
There was a problem hiding this comment.
P2: The severity field on CapabilityIssue is typed as str but documented and universally used as one of three exact values ("blocking", "silent_drop", "collision"). The project already uses Literal for this pattern (ChangeKind = Literal["added", "removed", "modified"] in differ.py). Using Literal["blocking", "silent_drop", "collision"] would catch typos at type-check time and keep the codebase consistent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At hdp/engine/port/coverage.py, line 28:
<comment>The `severity` field on `CapabilityIssue` is typed as `str` but documented and universally used as one of three exact values (`"blocking"`, `"silent_drop"`, `"collision"`). The project already uses `Literal` for this pattern (`ChangeKind = Literal["added", "removed", "modified"]` in `differ.py`). Using `Literal["blocking", "silent_drop", "collision"]` would catch typos at type-check time and keep the codebase consistent.</comment>
<file context>
@@ -0,0 +1,45 @@
+ component_id: str
+ layer: str
+ type: str
+ severity: str # "blocking" | "silent_drop" | "collision"
+ reason: str
+
</file context>
Summary by cubic
Adds cross-backend porting between
nexauandmini-swe-agentwith an honest coverage audit and report; introduceshdp.engine.port(audit()andport()) plus aportCLI/subcommand.New Features
hdp.engine.port:audit(doc, dest_target)enumerates coverage gaps;port(source → dest)runs lift → audit → generate, writeshdp_port_coverage.json, and refuses on blocking issues unlessallow_partial.CapabilityIssueandCoverageReportwith severitiesblocking,silent_drop,collision.nexau: flags blocking policy/non-external verifier, unresolvable tool bindings, and destination collisions.mini-swe-agent: flags blocking policy/non-external verifier, unresolvable tool bindings, andsystem_rulesids with no manifest slot assilent_drop.python -m hdp.engine.port ...andhdp.engine.run port; config viahdp.portblock (seeconfigs/hdp/port-example.yaml). Scope isnexau↔mini-swe-agent(openharness excluded).$0e2e and adapter coverage tests ensuring honest reporting and refusal behavior.Refactors
capability_issues(doc);base.FrameworkAdapterprovides a no-op default._reject_unsupportedroutes throughcapability_issuesbut preserves behavior: policy/verifier remainNotImplementedError; unresolvable tool bindings still raiseValueErrorduringgenerate().STATUS.mdupdated with Phase 6portreadiness.Written for commit 491055f. Summary will update on new commits.