Codex/specimba/UI polish command center#5
Conversation
Docstrings generation was requested by @specimba. * #1 (comment) The following files were modified: * `app.py` * `src/nexus_visual_weaver/render.py` * `tests/test_command_center.py` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Canberk “specimba” Karaerkek <specimba@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Code Review by Qodo
Context used✅ Compliance rules (platform):
1 rule 1. NEXUS_EXPORT_DIR allows src/ writes
|
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Docstrings generation - SUCCESS |
There was a problem hiding this comment.
Code Review
This pull request updates the NEXUS Visual Weaver application by transitioning the public demo stack to use the FLUX.2-klein-4B model, integrating optional sponsor evidence lanes for OpenBMB MiniCPM-V and NVIDIA Nemotron, and adding a governed export packet writer. The review feedback focuses on enhancing robustness and error handling across these new features. Key recommendations include updating the sponsor lane badge check to recognize the hf_nvidia provider, catching general OSError rather than just PermissionError during export directory creation, wrapping file-reading operations in try-except blocks, and broadening exception catching and decoding safety in the provider runtime API wrappers to prevent unhandled crashes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Docstrings generation was requested by @specimba. * #5 (comment) The following files were modified: * `app.py` * `src/nexus_visual_weaver/catalog.py` * `src/nexus_visual_weaver/exporter.py` * `src/nexus_visual_weaver/hf_runtime.py` * `src/nexus_visual_weaver/model_relay.py` * `src/nexus_visual_weaver/provider_runtime.py` * `src/nexus_visual_weaver/render.py`
PR Summary by QodoCommand Center UI Polish: Sponsor Lanes, Export Packet, and HF Space Readiness WalkthroughsDescription• Switches the public demo FLUX.2 lane from the gated 9B model to the public 4B model, keeping 9B as a private-research-only option. • Adds two new optional sponsor evidence lanes: OpenBMB MiniCPM-V 4.6 (visual judge) and NVIDIA Nemotron-Parse v1.2 (structured evidence), wired into the run_weave callback and surfaced in the inspector and provider cards. • Introduces exporter.py to write governed JSON export packets (with hackathon prize-claim evidence) and provider_runtime.py to call MiniCPM-V and Nemotron via OpenAI-compatible APIs. • Adds an above-fold ST3GG trust strip to the topbar, hardens approve_checkpoint to require a generated artifact, and fixes duplicate/stale code blocks in app.py and render.py. • Updates catalog, model relay, schema, and styles to reflect the public/private stack split and new sponsor models; adds ST3GG fixture PNGs and a hackathon handoff document. Diagramgraph TD
A["app.py\nCallbacks"] --> B["provider_runtime.py\nMiniCPM-V / Nemotron"]
A --> C["hf_runtime.py\nFLUX.2 Klein 4B"]
A --> D["security.py\nST3GG Scanner"]
A --> E["exporter.py\nExport Packet Writer"]
A --> F["render.py\nDashboard Regions"]
F --> G["styles.py\nTrust Strip CSS"]
C --> H[("HF ZeroGPU Space")]
B --> I[("OpenBMB / NVIDIA APIs")]
E --> J[("outputs/exports JSON")]
subgraph Legend
direction LR
_mod["Module"] ~~~ _db[("Storage")] ~~~ _ext[("External API")]
end
High-Level AssessmentThe following are alternative approaches to this PR: 1. Keep a subset of the removed render/callback tests
2. Use httpx or requests for provider API calls
Recommendation: The PR's approach of using stdlib urllib for sponsor API calls (provider_runtime.py) is intentional to avoid adding httpx/requests as a dependency in a Space environment. This is reasonable. However, the test suite pruning is aggressive — ~400 lines of tests were removed across three test files. While many were redundant after the refactor, some covered edge cases (e.g., render_artifact_lane preview mode labels, stop_provider_job, toggle_adult_visibility tuple length) that no longer have explicit coverage. Consider whether the removed tests should be replaced with lighter equivalents rather than dropped entirely. File ChangesEnhancement (7)
Tests (6)
Documentation (3)
Other (4)
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d525f1509f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| next_state = {**state, "provider_state": "blocked", "export": scan.get("export_gate", "blocked"), "message": "Export blocked: ST3GG gate is not clear."} | ||
| else: | ||
| next_state = {**state, "provider_state": "exported", "export": "clear", "message": "Governed export packet prepared with run, catalog, and ST3GG evidence."} | ||
| export = write_export_packet(run=run, scan=scan, operator_state=state, adult_mode=adult_mode) |
There was a problem hiding this comment.
Bind export scans to generated artifacts
When a generated artifact's ST3GG result is blocked, an operator can click Scan Reference with any clean upload, which updates scan_state to that reference scan while leaving operator_state['generation']['output_path'] pointed at the generated file. This call then writes an export packet for the generated artifact using the unrelated clear scan, so a blocked output can be approved/exported after scanning a different file; use the stored generated scan or verify the scan belongs to the artifact path before exporting.
Useful? React with 👍 / 👎.
| adult_mode: bool, | ||
| ) -> dict[str, Any]: | ||
| run_id = getattr(getattr(run, "checkpoint", None), "checkpoint_id", f"nw-{int(time.time())}") | ||
| stack = active_stack(adult_mode) |
There was a problem hiding this comment.
Preserve the run's model stack in exports
If Adult Mode is toggled after creating a run, the export packet recomputes the stack from the current checkbox instead of the run that is being exported. That can make the JSON claim the public FLUX.2 4B stack for a private FLUX.2 9B/OFFELLIA run, or the reverse, corrupting the parameter-budget and governance evidence; derive the stack and adult flag from run.model_stack / run.request.adult_mode.
Useful? React with 👍 / 👎.
| "openbmb": "configured" if _env_configured("MINICPM_API_KEY", "OPENBMB_API_KEY") else "missing secret", | ||
| "nvidia": "configured" if _env_configured("NEMOTRON_API_KEY", "NVIDIA_API_KEY") else "missing secret", |
There was a problem hiding this comment.
Require provider base URLs before showing configured
These cards show OpenBMB/NVIDIA as CONFIGURED when only an API key is present, but the actual judge adapters return missing_secret unless MINICPM_BASE_URL or NEMOTRON_BASE_URL is also set. In Spaces with just the token secret configured, the UI will advertise ready sponsor lanes while run_weave cannot call them, so include the required base URL in the configured check.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app.py (1)
281-299:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftKeep the export gate bound to the generated artifact, not the reference scan.
This callback now returns the reference-upload
scaninto the sharedscan_stateslot.approve_checkpoint()andexport_packet()consume that same state for ST3GG gating, so a later reference rescan can unblock or block export based on the wrong file. The generated artifact scan needs its own authoritative state, with reference evidence stored separately.As per coding guidelines, "
**/*.py: Review Gradio callback wiring and region updates in code changes" and "app.py: Check that UI callbacks update the intended regions, never leak secrets, and keep Adult Mode security gates active."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app.py` around lines 281 - 299, The export gate in the next_state dictionary is being set from the reference scan instead of the generated artifact, which causes approve_checkpoint() and export_packet() to use the wrong gate. Modify the next_state construction to preserve the export gate from the generated artifact (keep it from the previous operator_state rather than overriding it with scan.get("export_gate")), and instead store the reference scan's export gate separately (for example as "reference_export_gate") for evidence purposes. Update the message logic to reference the reference scan's gate status for user feedback without allowing it to control the actual export authorization.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app.py`:
- Around line 283-290: The `judge_with_minicpm()` call on line 285-290 uses a
fallback to `_file_path(upload)` for the image_path parameter when
`generated_path` is missing. This causes the reference upload to be evaluated
instead of the generated artifact, producing false scoring evidence for a review
that never happened. Modify the logic to only call `judge_with_minicpm()` when a
generated artifact actually exists (i.e., when `generated_path` is not None or
empty), or implement proper handling for the no-artifact case to ensure the
operator state accurately reflects whether scoring was performed on a generated
artifact or not.
In `@docs/HANDOFF_FINAL_HACKATHON.md`:
- Around line 27-35: The NEXUS_DISABLE_REAL_HF environment flag must be set
before any HF-dependent commands to prevent live API access during verification.
In docs/HANDOFF_FINAL_HACKATHON.md (lines 27-35), move the
`$env:NEXUS_DISABLE_REAL_HF='1'` assignment to appear before the `python -c
"import app; print('app import ok')"` line so it gates the app import check. In
README.md (lines 111-117), add `$env:NEXUS_DISABLE_REAL_HF='1'` before the
pytest command to ensure the flag is set during testing. This ensures both
documentation sources match CI behavior and prevent divergence when users follow
the verification steps.
In `@README.md`:
- Around line 95-96: The OpenBMB and NVIDIA prize claim conditions in the
README.md are currently based only on the presence of evidence in an export
packet, which allows failed or incomplete runs to appear claimable. Update both
rows to require that `success` is present in the export packet, in addition to
or instead of the evidence check. This ensures that only successful runs with
valid evidence can be claimed as prizes, making the conditions consistent with
the rest of the documentation.
In `@src/nexus_visual_weaver/exporter.py`:
- Around line 14-30: In the export_root() function, remove the dead code
condition checking if candidate is None and its associated continue statement.
This check is unreachable because the candidates list only contains Path objects
created on lines 16-19 and never includes None values, making the condition
impossible to ever be True.
In `@src/nexus_visual_weaver/provider_runtime.py`:
- Around line 55-67: Add URL scheme validation to the _post_json function before
calling urllib.request.urlopen. Use urllib.parse.urlparse to extract the scheme
from the url parameter and validate that it is one of the expected schemes (such
as https or http). If the scheme is not in the allowlist of expected schemes,
raise an appropriate exception (such as ValueError) with a clear error message.
This validation should occur after the request object is created but before the
urlopen call to ensure only safe URL schemes are used.
In `@src/nexus_visual_weaver/render.py`:
- Around line 55-64: The provider configuration status badges do not account for
all required environment variables that the runtime actually needs. The MiniCPM
and Nemotron provider checks in the configured list only verify API keys
(MINICPM_API_KEY, OPENBMB_API_KEY, NEMOTRON_API_KEY, NVIDIA_API_KEY) but the
actual runtime calls also require base URLs (MINICPM_BASE_URL,
NEMOTRON_BASE_URL). Update the _env_configured calls for MiniCPM and Nemotron to
include checks for their respective base URL environment variables alongside the
API key checks, so the status badges accurately reflect whether a provider can
actually be used at runtime. Apply this same fix to all other locations where
these provider configuration checks appear.
- Around line 109-126: The ST3GG findings and purification_actions are being
rendered directly into HTML without redacting potentially sensitive content like
payload excerpts or recovered hidden data, which violates the security
guideline. Create a redaction function that removes sensitive payload bytes and
hidden content from scan results, then apply this function to the findings and
actions values before they are escaped and rendered in the HTML template (where
findings[0] and actions[0] are currently being used in the escape() calls).
Apply the same redaction logic at the other affected location mentioned in the
comment (lines 667-694) where similar rendering of findings and actions occurs.
In `@tests/test_app_callbacks.py`:
- Line 30: Before setting the operator_state with the hardcoded output_path
value of "outputs/test-generated-artifact.png" on line 30, ensure the artifact
file is actually created at that path. This prevents the test from becoming
flaky when artifact-existence gating validates that the file exists. Create the
"outputs/test-generated-artifact.png" file in your test setup or as a fixture
before the assertion that depends on this path.
---
Outside diff comments:
In `@app.py`:
- Around line 281-299: The export gate in the next_state dictionary is being set
from the reference scan instead of the generated artifact, which causes
approve_checkpoint() and export_packet() to use the wrong gate. Modify the
next_state construction to preserve the export gate from the generated artifact
(keep it from the previous operator_state rather than overriding it with
scan.get("export_gate")), and instead store the reference scan's export gate
separately (for example as "reference_export_gate") for evidence purposes.
Update the message logic to reference the reference scan's gate status for user
feedback without allowing it to control the actual export authorization.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c31802fd-f22f-4d73-b70c-583b633efdd2
⛔ Files ignored due to path filters (2)
tests/fixtures/st3gg_blocked_trailing.pngis excluded by!**/*.pngtests/fixtures/st3gg_safe_clean.pngis excluded by!**/*.png
📒 Files selected for processing (20)
.github/workflows/ci.ymlREADME.mdapp.pyassets/st3gg_examples.jsondocs/HACKATHON_EVALUATION.mddocs/HANDOFF_FINAL_HACKATHON.mdsrc/nexus_visual_weaver/catalog.pysrc/nexus_visual_weaver/exporter.pysrc/nexus_visual_weaver/hf_runtime.pysrc/nexus_visual_weaver/model_relay.pysrc/nexus_visual_weaver/provider_runtime.pysrc/nexus_visual_weaver/render.pysrc/nexus_visual_weaver/schema.pysrc/nexus_visual_weaver/styles.pytests/test_app_callbacks.pytests/test_command_center.pytests/test_exporter.pytests/test_hf_runtime.pytests/test_model_relay.pytests/test_provider_runtime.py
| ```powershell | ||
| python -m compileall app.py src tests | ||
| python -c "import app; print('app import ok')" | ||
| $env:NEXUS_DISABLE_REAL_HF='1' | ||
| $env:PYTEST_DISABLE_PLUGIN_AUTOLOAD='1' | ||
| python -m pytest -q tests -p no:cacheprovider | ||
| hf auth whoami --format json | ||
| hf spaces info build-small-hackathon/NEXUS_Visual_Weaver --format json | ||
| ``` |
There was a problem hiding this comment.
Set the HF-disable flag before any HF-dependent verification command.
The documented verification flows should gate live HF access before import app or pytest. Right now the handoff imports first and the README omits the flag entirely, so copying the docs can still hit the live path and diverge from CI.
docs/HANDOFF_FINAL_HACKATHON.md#L27-L35: move$env:NEXUS_DISABLE_REAL_HF='1'abovepython -c "import app; print('app import ok')"and keep it set for the pytest step.README.md#L111-L117: add$env:NEXUS_DISABLE_REAL_HF='1'before the pytest command.
♻️ Proposed fix
- python -m compileall app.py src tests
- python -c "import app; print('app import ok')"
- $env:NEXUS_DISABLE_REAL_HF='1'
+ $env:NEXUS_DISABLE_REAL_HF='1'
+ python -m compileall app.py src tests
+ python -c "import app; print('app import ok')"
$env:PYTEST_DISABLE_PLUGIN_AUTOLOAD='1'
python -m pytest -q tests -p no:cacheprovider python -m compileall app.py src tests
+$env:NEXUS_DISABLE_REAL_HF='1'
$env:PYTEST_DISABLE_PLUGIN_AUTOLOAD='1'
python -m pytest -q tests -p no:cacheprovider --basetemp=C:\tmp\pytest-nvw-full📍 Affects 2 files
docs/HANDOFF_FINAL_HACKATHON.md#L27-L35(this comment)README.md#L111-L117
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/HANDOFF_FINAL_HACKATHON.md` around lines 27 - 35, The
NEXUS_DISABLE_REAL_HF environment flag must be set before any HF-dependent
commands to prevent live API access during verification. In
docs/HANDOFF_FINAL_HACKATHON.md (lines 27-35), move the
`$env:NEXUS_DISABLE_REAL_HF='1'` assignment to appear before the `python -c
"import app; print('app import ok')"` line so it gates the app import check. In
README.md (lines 111-117), add `$env:NEXUS_DISABLE_REAL_HF='1'` before the
pytest command to ensure the flag is set during testing. This ensures both
documentation sources match CI behavior and prevent divergence when users follow
the verification steps.
|
✅ Unit tests committed locally. Commit: |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 7 file(s) based on 8 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 7 file(s) based on 8 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Code Review SummaryStatus: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (7 files)
|
| "prompt": getattr(getattr(run, "request", None), "prompt", ""), | ||
| "refined_prompt": getattr(getattr(run, "refined_prompt", None), "refined", ""), | ||
| "artifact": (operator_state.get("generation") or {}).get("output_path"), | ||
| "generation": generation, |
There was a problem hiding this comment.
CRITICAL: Potential information disclosure - output_path path exposed in export packet
The artifact field contains the raw file path which could reveal internal directory structure. Consider sanitizing to only include filename.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| "Content-Type": "application/json", | ||
| }, | ||
| method="POST", | ||
| ) |
There was a problem hiding this comment.
WARNING: URL scheme validation added but error message could be more helpful
The scheme check is good for security, but the error message could include the actual URL that failed for debugging.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| operator_state = operator_state or {} | ||
| status = str(scan.get("status", "idle")).upper() | ||
| export_gate = str(scan.get("export_gate", "pending")).upper() | ||
| checkpoint = str(operator_state.get("checkpoint", "pending")).replace("_", " ").title() |
There was a problem hiding this comment.
WARNING: Missing _scan_status_tone function definition in diff context
This function is called on line 125 but its definition appears at line 622 in the original file. Ensure the function exists in the correct location for the new code path.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| @@ -623,8 +590,6 @@ def render_provider_cards(relay_status: dict | None = None, adult_mode: bool = F | |||
| <span>{escape(str(provider))} / {escape(str(gate))}</span> | |||
There was a problem hiding this comment.
WARNING: Missing key access could cause display issues
Line 606 accesses provider in {"openbmb", "nvidia", "hf_nvidia"} but line 576 uses primary.get("provider", "blocked") which may return 'blocked' string, potentially causing incorrect badge rendering.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 9 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Other Observations (not in diff)Issues found in unchanged code:
Files Reviewed (14 files)
Fix these issues in Kilo Cloud Reviewed by nex-n2-pro:free · 1,335,889 tokens |
| reference_scan = scan_file(reference_path) | ||
| generated_scan = _authoritative_generated_scan(state) | ||
| minicpm = None | ||
| if run is not None and reference_path: |
There was a problem hiding this comment.
WARNING: scan_reference invokes sponsor judging on the uploaded reference image
scan_reference() is the reference-upload scan path, but this block calls judge_with_minicpm() with reference_path whenever a reference file exists. The resulting reference_judge state is not rendered in the sponsor evidence UI, so configured secrets can trigger an unexpected external provider call and send the reference image to OpenBMB without visible operator evidence.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| "reference_scan": reference_scan, | ||
| "reference_export_gate": reference_scan.get("export_gate", "pending"), | ||
| "export": state.get("export", generated_scan.get("export_gate", "pending")), | ||
| "message": ( |
There was a problem hiding this comment.
WARNING: scan_reference can preserve stale export-gate state
This merges the previous export value from operator state instead of deriving export state from _authoritative_generated_scan(state). If a stale clear export gate is already present, the UI/operator state can remain clear even when the generated artifact scan is blocked; checkpoint/export callbacks recompute the gate, but the intermediate state can still be inconsistent.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| def _post_json(url: str, token: str, payload: dict[str, Any], timeout: float) -> dict[str, Any]: | ||
| parsed = urllib.parse.urlparse(url) | ||
| if parsed.scheme not in {"http", "https"} or not parsed.netloc: | ||
| raise ValueError(f"Invalid URL: expected http(s) URL with host, got {url!r}.") |
There was a problem hiding this comment.
WARNING: Invalid URL error may leak query credentials
Including the full configured URL in the exception is useful for debugging, but Space/provider base URLs can contain query-string secrets. Because this exception is surfaced through provider results and potentially the UI, prefer a redacted URL or only include scheme/netloc/path without query credentials.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| def _redact_scan_text(value: object) -> str: | ||
| text = str(value) | ||
| lowered = text.lower() | ||
| if any(term in lowered for term in _SCAN_REDACTION_TERMS): |
There was a problem hiding this comment.
WARNING: ST3GG rendering redaction is keyword-allowlist based
The redaction only triggers for specific terms such as payload, hidden content, and base64. If a future scanner finding contains raw payload bytes or recovered content with different wording, it will be escaped but still displayed. For a security boundary, prefer redacting at the scanner/export boundary or defaulting findings/actions to redacted unless they are explicitly allowlisted as safe metadata.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
PR #5 follow-up verification after commit
Local gates:
HF Space:
Known external blocker:
|
There was a problem hiding this comment.
💡 Codex Review
When a generated artifact fails ST3GG, this still base64-embeds the original file into the dashboard HTML before the export gate is checked. For the blocked PNG trailing-data case, the browser receives the full data URI including the hidden trailing bytes, so use a sanitized thumbnail or suppress the preview until the generated scan is clear.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if run is not None and reference_path: | ||
| minicpm = judge_with_minicpm( |
There was a problem hiding this comment.
Gate MiniCPM scans on a clear ST3GG result
When MiniCPM secrets are configured, clicking Scan Reference with a PNG that ST3GG just marked blocked still enters this branch and sends reference_path to judge_with_minicpm; that adapter base64-encodes the whole file before posting it. In the blocked trailing-payload case covered by the new fixtures, this leaks the unpurified hidden bytes to an external provider before review, so this call should be skipped unless the reference scan is clear or a purified derivative is used.
Useful? React with 👍 / 👎.
| scan = scan_file(_file_path(upload)) | ||
| generation = generate_flux_image(run.refined_prompt.refined, seed=int(run.checkpoint.checkpoint_id[-6:], 16) % 1_000_000) | ||
| reference_scan = scan_file(_file_path(upload)) | ||
| generation = generate_flux_image(run.refined_prompt.refined, seed=_checkpoint_seed(run.checkpoint.checkpoint_id)) |
There was a problem hiding this comment.
Route adult-mode generation to the run's selected stack
Fresh evidence beyond the prior export-stack issue: when Adult Mode is enabled, build_command_center_run(..., adult_mode=True) records the private research stack headed by FLUX.2 9B, but this generation call has no mode/repo argument and generate_flux_image always uses the 4B FLUX_REPO_ID. Adult/private runs on a Space can therefore produce and export a 4B artifact while the run/model-stack evidence says 9B/private stack, corrupting the governance and parameter-budget record for that run.
Useful? React with 👍 / 👎.
|
|
||
| def _post_json(url: str, token: str, payload: dict[str, Any], timeout: float) -> dict[str, Any]: | ||
| parsed = urllib.parse.urlparse(url) | ||
| if parsed.scheme not in {"http", "https"} or not parsed.netloc: |
There was a problem hiding this comment.
Reject non-local plaintext provider URLs
If a Space secret sets MINICPM_BASE_URL or NEMOTRON_BASE_URL to a non-local http:// endpoint, this check accepts it and _post_json sends the bearer token plus the image/run payload over cleartext. That exposes provider credentials and generated/reference artifacts on the network; keep HTTPS required for remote hosts and only allow plaintext for explicit localhost development endpoints.
Useful? React with 👍 / 👎.
| return None | ||
| suffix = target.suffix.lower() | ||
| mime = "image/png" if suffix == ".png" else "image/jpeg" if suffix in {".jpg", ".jpeg"} else "image/webp" | ||
| data = base64.b64encode(target.read_bytes()).decode("ascii") |
There was a problem hiding this comment.
Bound image size before base64 provider uploads
When a user scans a large uploaded reference with MiniCPM configured, this reads the entire file into memory and then base64-encodes it before posting, so a single oversized upload can spike memory and stall or kill the Space process. The ST3GG scanner only samples the file and does not cap this provider path, so enforce a size limit before read_bytes() or stream/reject large artifacts.
Useful? React with 👍 / 👎.
| suffix = target.suffix.lower() | ||
| mime = "image/png" if suffix == ".png" else "image/jpeg" if suffix in {".jpg", ".jpeg"} else "image/webp" | ||
| data = base64.b64encode(target.read_bytes()).decode("ascii") |
There was a problem hiding this comment.
Verify image signatures before MiniCPM uploads
When the uploaded file is not a supported image that ST3GG already blocks, this helper still labels every non-PNG/JPEG suffix as image/webp and base64-encodes the bytes. With MiniCPM secrets configured, a low-entropy .txt or other arbitrary upload can be sent to the visual provider as an image instead of returning no_artifact; validate the extension/magic against supported image types before reading and posting the file.
Useful? React with 👍 / 👎.
| run=run, | ||
| adult_mode=adult_mode, | ||
| scan=scan, | ||
| scan=generated_scan, |
There was a problem hiding this comment.
Surface blocked reference scans during runs
If the operator uploads a blocked reference and starts a run, the reference is scanned but the dashboard and scan state are rendered from generated_scan instead. In local dry-run/no-artifact cases this makes the trust strip and evidence JSON show idle/pending while the uploaded reference is already blocked, so surface the reference scan separately or include its warning without letting it clear the generated artifact's export gate.
Useful? React with 👍 / 👎.
What Changed
Why
Safety Gates
Verification
python -m compileall app.py src testspython -m pytest -q tests -p no:cacheprovider --basetemp=C:\tmp\pytest-nvw-fullScreenshots / Notes
Note
Add trust strip UI, sponsor judge lanes, and governed export packet to command center
judge_with_minicpm(OpenBMB MiniCPM-V-4.6) andjudge_with_nemotron(NVIDIA Nemotron-Parse-v1.2) in a newprovider_runtime.pymodule, called fromrun_weaveandscan_reference.render_trust_stripcomponent injected into the topbar, showing ST3GG scan status, export gate, and human checkpoint state with payload redaction.exporter.pythat assembles a JSON evidence packet with redacted secrets, hackathon claims, and sponsor lane statuses, gated on ST3GG clearance.scan_referenceandapprove_checkpoint, making the generated artifact's ST3GG status authoritative for export gating.public_demofield (defaultTrue) toModelCandidateand uses it to filter catalog in public mode.render_topbarsignature mismatch noted in analysis — callers pass four arguments while the shown definition accepts two, which may cause aTypeErrorat runtime if not reconciled elsewhere.Macroscope summarized 1cca102.
Dashboard & Workflow Integration
The command center now surfaces a complete visual creation workflow with integrated evidence rendering.
app.pyhas been refactored to wire FLUX.2 generation through checkpoint seeding, dual-track scan execution (reference and generated), and downstream judge integration. The dashboard rendering (render.py) adds a new trust strip UI component and updates the topbar to display "FLUX.2 4B PINNED" alongside "HUMAN CHECKPOINT" badges. The artifact lane now renders generated images inline with updated metadata ribbons, and the operations panel surfaces both MiniCPM and Nemotron evidence lanes when available. Workflow node labels have been adjusted to reflect the new model/provider structure, and the inspector now includes a "Sponsor Evidence" section populated from operator state.Model Governance & Pinned Lane Selection
The pinned FLUX.2 image-generation lane has been downscaled from Klein 9B to Klein 4B as the public-demo default (4B remains the MVP target for the Build Small hackathon). The catalog has been restructured to enforce this via
active_stack(): the public demo stack now selects FLUX.2-klein-4B exclusively, while a separatePRIVATE_RESEARCH_STACKretains Klein 9B for private-mode fallback. NVIDIA LocateAnything-3B remains pinned for grounding. ModelRelay'sROTATABLE_LANESnow includesprivate_image_research, allowing qualified helper models to rotate subject to quota constraints, while pinned lanes remain static. Two new judgment lanes have been added—MiniCPM-V-4.6 (visual analysis) and NVIDIA-Nemotron-Parse-v1.2 (evidence synthesis)—both marked as optional sponsor lanes in the dashboard with distinct success/missing-secret/failed state rendering.Security Gate & Export Evidence Packaging
ST3GG security scanning remains the always-on gate; a new
assets/st3gg_examples.jsondefines scan test cases. The newexporter.pymodule implementswrite_export_packet(), which constructs a comprehensive JSON evidence record containing run metadata, operator state (generation, minicpm evidence, nemotron evidence results), checkpoint status, active model stack with parameter counts, and hackathon claim booleans (build_small_32b pass, OpenBMB lane success, NVIDIA Nemotron lane success). Export is gated on checkpoint approval and scan clearance. Critically, Adult Mode remains opt-in and does not bypass provenance, consent, age, dataset-partition, or ST3GG gates—the public stack appliespublic_demo=Falsefiltering to exclude private-research models.Provider Runtime & Evidence Collection
A new
provider_runtime.pymodule introduces two judge functions:judge_with_minicpm(): ReadsMINICPM_BASE_URL,MINICPM_API_KEY, andMINICPM_MODELenvironment variables; constructs a constrained-JSON multimodal prompt with the artifact image, wardrobe summary, and scan results; calls the OpenBMB endpoint and returns structured evidence ormissing_secret/no_artifact/blockedstates.judge_with_nemotron(): ReadsNEMOTRON_BASE_URL,NEMOTRON_API_KEY, andNEMOTRON_MODEL; constructs a constrained-JSON prompt containing the full run packet and optional MiniCPM result (truncated for token efficiency); calls the NVIDIA endpoint and returns evidence ormissing_secret/failedstates.Both return a
ProviderJudgeResultdataclass with status, provider identification, evidence payload, and request latency. The runtime handles authentication, image encoding to base64 data URIs, and safe JSON parsing with error truncation.Verification & Testing Evidence
CI now gates imports with
NEXUS_DISABLE_REAL_HF=1to prevent real HF API calls during testing. New test coverage includes:test_exporter.py: Validates thatwrite_export_packet()records evidence correctly, includes hackathon lane flags, filters out secret tokens, and matches run IDs.test_provider_runtime.py: Tests MiniCPM missing-secret detection, artifact-missing blocking, successful judge execution with mocked endpoints, and Nemotron missing-secret handling.test_command_center.py: Updated to assert the public stack includes FLUX 4B while excluding Klein 9B and OFFELLIA (private models), and verifies LocateAnything is present by repo ID. Security scan fixtures now validate both safe (pass/clear) and blocked (review/blocked with findings) scan paths.test_model_relay.py: Expanded to verify FLUX.2 4B is pinned (non-rotating) with correct repo ID and parameter counts, and private-research lane keeps FLUX 9B available as rotatable primary.test_hf_runtime.py: New test assertsFLUX_REPO_IDandPRIVATE_RESEARCH_FLUX_REPO_IDare distinct values.Documentation (
HACKATHON_EVALUATION.md,HANDOFF_FINAL_HACKATHON.md) records prize claim rules (OpenBMB/NVIDIA evidence gated on export success from respective providers), required environment secrets (HF_TOKEN, MiniCPM/Nemotron credentials), and submission steps. README updated with Space metadata, model governance lane definitions, and required provider API keys.