Repository navigation
fix: honor ambient hot-reload and platform-aware badge tests - #1276
Conversation
…20260913 Welcome pull requests from all contributors
|
All three scoped commits were already present byte-for-byte on current master. Integrating ancestry-only Fresh exact executable acceptance with a private daemon/local provider fixture observed disabled startup with zero requests, config=true on next wake producing one cycle, config=false stopping further requests/cycles, and explicit ambient stop still winning after config=true. The real-loop, config-gate, and schedule-service regressions pass. Both full copy-badge cohorts passed: sixteen rendering tests with default config and sixteen with Unicode Alt label |
|
| env: | ||
| JCODE_CI: "1" |
There was a problem hiding this comment.
This workflow declares env twice at the top level, so GitHub Actions cannot parse it and none of its jobs can start. Merge JCODE_CI into the existing environment map. The same parse-breaking duplicate exists in ios-testflight.yml and windows-smoke.yml, so their environment maps also need to be consolidated before merging.
Artifacts
- Ruby/Psych AST source checks the three requested workflow roots without Hash-loading duplicate keys, providing a reproducible detector.
- Captured execution of the detector from `/home/user/repo` reports all three duplicate `env` keys and exit code 1, confirming the finding.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/ci.yml
Line: 3-4
Comment:
**Merge environment maps**
This workflow declares `env` twice at the top level, so GitHub Actions cannot parse it and none of its jobs can start. Merge `JCODE_CI` into the existing environment map. The same parse-breaking duplicate exists in `ios-testflight.yml` and `windows-smoke.yml`, so their environment maps also need to be consolidated before merging.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| base="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/resolve/main" | ||
| curl -sSfL --retry 3 -o "$model_dir/model.onnx" "$base/onnx/model.onnx" | ||
| curl -sSfL --retry 3 -o "$model_dir/tokenizer.json" "$base/tokenizer.json" | ||
| # Fail loudly if the fetch produced something unusable, so this cannot | ||
| # degrade back into a silent skip. | ||
| test -s "$model_dir/model.onnx" | ||
| test -s "$model_dir/tokenizer.json" |
There was a problem hiding this comment.
The embedding job downloads model.onnx and tokenizer.json from mutable resolve/main URLs, checks only that they are nonempty, and then loads them into the tokenizer and ONNX inference stack. An upstream replacement or compromise can therefore make CI process arbitrary replacement bytes. Pin reviewed immutable revisions and verify checked-in cryptographic checksums before loading either artifact.
How this was verified: A nonempty malformed model passed the workflow's existence check and reached the ONNX parser, while the configured URLs use mutable branch references without integrity verification.
Artifacts
- The executed shell verifier inspects the CI fetch and consumer path, injects a malformed nonempty model, and runs the actual numeric-stability test; it demonstrates that existence checks do not provide integrity.
- Complete captured output from the verifier run shows the mutable URLs, absent cryptographic check, parser failure for a malformed nonempty ONNX file, and passing execution with currently downloaded artifacts; it confirms unverified bytes reach the parser.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/ci.yml
Line: 259-265
Comment:
**Pin model downloads**
The embedding job downloads `model.onnx` and `tokenizer.json` from mutable `resolve/main` URLs, checks only that they are nonempty, and then loads them into the tokenizer and ONNX inference stack. An upstream replacement or compromise can therefore make CI process arbitrary replacement bytes. Pin reviewed immutable revisions and verify checked-in cryptographic checksums before loading either artifact.
**How this was verified:** A nonempty malformed model passed the workflow's existence check and reached the ONNX parser, while the configured URLs use mutable branch references without integrity verification.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| /// Re-read enabled on each loop iteration, without overriding an explicit stop. | ||
| /// Config edits take effect on the next wake, not on the config cache's cadence. |
There was a problem hiding this comment.
This comment promises that configuration edits take effect on the next wake, but production configuration reads may return the cached value for up to 500 ms. A wake immediately after an edit can therefore still use the old ambient.enabled setting. This is a non-blocking documentation concern, but leaving it inaccurate can cause future lifecycle code and tests to rely on a timing guarantee the implementation does not provide.
| /// Re-read enabled on each loop iteration, without overriding an explicit stop. | |
| /// Config edits take effect on the next wake, not on the config cache's cadence. | |
| /// Re-read enabled on each loop iteration, without overriding an explicit stop. | |
| /// Config edits take effect after the config cache refreshes on a subsequent wake. |
Artifacts
- Authored shell script builds and runs a non-test cache probe before and after the 500 ms interval, then runs the focused ambient runner reload test; it demonstrates the timing comparison.
- Executed non-test probe warmed the disabled config cache, edited the file to enabled, and immediately re-read it; it shows the old false value remains visible.
- Executed the same non-test probe after a 550 ms delay; it shows the edited true value is reloaded after the production cache cadence.
- Executed the focused ambient runner unit test without explicit cache invalidation; it passes, but the test build uses the zero-duration cache interval and therefore does not prove production next-wake timing.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-app-core/src/ambient/runner.rs
Line: 31-32
Comment:
**Correct reload timing**
This comment promises that configuration edits take effect on the next wake, but production configuration reads may return the cached value for up to 500 ms. A wake immediately after an edit can therefore still use the old `ambient.enabled` setting. This is a non-blocking documentation concern, but leaving it inaccurate can cause future lifecycle code and tests to rely on a timing guarantee the implementation does not provide.
```suggestion
/// Re-read enabled on each loop iteration, without overriding an explicit stop.
/// Config edits take effect after the config cache refreshes on a subsequent wake.
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
Summary
Fixes #1269. Fixes #1275.
Two independently reviewable, narrow fixes from issue triage:
ambient:statusreportsenabled: true#1269: Re-readambient.enabledat the loop gate instead of retaining the startup value. Preserve explicitAmbientStatus::Disabled, startup-only reply pollers, and the existing scheduler/wake policy. Add a disk-config regression covering false → true → false and the explicit-stop override.Alt. No production badge rendering changes.Commits: 2200140 (#1269), 180e95d (#1275).
Verification
Performed on Linux x86_64 through the coordinated self-dev test/build queue:
JCODE_HOMEand[display] copy_badge_alt_label = "⌥": 18 != 16 before the fixture fix.scripts/dev_cargo.sh test --offline --locked -p jcode-tui --lib copy_badge -- --test-threads=1: 16 passed with defaultAlt, and 16 passed with configured⌥, including platform-default and trimmed-override tests.--exact --test-threads=1under each label: 4 exact invocations passed on the final formatted tree.scripts/dev_cargo.sh test --offline --locked -p jcode-app-core --lib ambient::runner:: -- --test-threads=1: 6 passed, including the new toggle regression and real running-loop hot-reload regression and existing disabled-ambient scheduled-task coverage.scripts/dev_cargo.sh build --profile selfdev -p jcode --bin jcode: passed viaselfdev build.git diff --checkandrustfmt --check --edition 2024on all three changed files: passed.Measured behavior follow-up
Additional regression coverage in c515991 exercises the actual
run_loop, not just the extracted gate. It starts disabled, editsconfig.tomlto enable ambient without invalidating the cache, and observes the loop enterPausedfor an active user session after nudging it. This exercises file fingerprint reload and the production gate without model inference.Restoring the old startup-snapshot gate made this exact test fail after its 3-second observation deadline. Restoring the fix made it pass, along with all six ambient runner tests. This establishes a behavioral improvement at the real loop boundary, while not claiming a full CLI/daemon or native macOS acceptance run.
Limits and non-goals
⌥coverage exercises the reported width difference, not the macOS OS/runtime.Hosted CI follow-up
This PR is draft pending hosted checks and native macOS validation. The CI run, Windows smoke, and iOS workflow all failed before creating any jobs.
gh run viewreports a likely workflow-file issue, and these unchanged base workflows each contain duplicate top-levelenvmaps. The existing repair is tracked by #1191 / PR #1193 and is not duplicated here. Require Linked Issue passed. Local test/build results above remain valid, but this is not green hosted CI.Jcode agent (automated triage), on behalf of @1jehuang