refactor: harden silent-failure paths in tracker, modal sandbox, ask modal - #354
Closed
lfiaschi wants to merge 1 commit into
Closed
refactor: harden silent-failure paths in tracker, modal sandbox, ask modal#354lfiaschi wants to merge 1 commit into
lfiaschi wants to merge 1 commit into
Conversation
…modal Targeted fixes from a deep codebase review. Each addresses a verified bug or architectural violation with a concrete failing scenario; agent-surfaced findings that did not hold up under verification (e.g. visibility checks already gated by route handlers, infinite-scroll math, gauntlet entropy regex flag scope) were dropped to keep this PR focused. server/domain/gauntlet.py Remove the loguru import + log call that ran inside `run_static_checks`. Domain functions must return or raise — logging happens at the API/infra boundary (CLAUDE.md). The caller in publish_pipeline already logs grade + passed; extend that line with source_files count so no info is lost. server/domain/tracker_service.py `parse_semver(manifest_version) > parse_semver(latest.semver)` raised ValueError on a single malformed string (e.g. a `version_hint: "v1.2.3"` in any tracked manifest), aborting the entire tracker run. Wrap the comparison in a `_hint_is_higher` helper that returns False on parse failure so we fall back to auto-bump. Adds 7 regression tests. server/infra/modal_client.py The bash wrapper around `uv sync` always exited 0 because its last command was an `echo`, so `_run_in_sandbox` saw rc=0 even when deps failed to install. The agent later started, immediately crashed on a missing import, and the eval surfaced a confusing "agent crashed" message instead of "deps failed". Make the bash exit with the actual uv sync rc, raise on non-zero, and trim the success log so we don't ship hundreds of bytes of subprocess output to logs on the happy path. Adds a regression test that simulates uv sync exit=1. frontend/components/AskModal.tsx `messages`, `query`, and `error` were never reset when the modal was reopened. Closing mid-conversation and reopening surfaced stale answers — confusing UX and a violation of the "reset state on context changes" rule in CLAUDE.md. Add a useEffect that clears state on each open. Adds a regression test using rerender to toggle isOpen. Tests: 941 server / 83 frontend / 291 client all green. Lint, typecheck, format: clean. https://claude.ai/code/session_012v9S3rfspyGQKLRXY3iTKc
Contributor
Author
|
Closing as part of the 2026-08-11 open-PR consolidation. This automated review-sweep PR overlaps heavily with the retained merge queue (#449, #448, #447, #446, #405, then #438, #443, #375). Unique fixes not covered by the retained set are catalogued in #451 for a follow-up best-of PR. The branch is preserved, so nothing is lost. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR is the action half of a two-step "deep review + fix" pass. The review surveyed architecture, code health, bugs, security, performance, and tests across server, client, frontend, and shared. Findings were verified against the actual code before any change was made — agent-surfaced claims that did not hold up under verification were dropped (e.g.
find_audit_logsis already gated by the route handler,find_eval_runalready checksuser_id,useInfiniteScroll's pagination math is correct, gauntlet's entropy(?-i:...)is supported by Python 3.7+ regex). The four fixes below are the verified, high-leverage subset that fit in one focused review.What changes
server/domain/gauntlet.pyrun_static_checksimported and calledloguru.logger— domain functions must return or raise (CLAUDE.md)publish_pipelinealready logs grade + passed and now also logssource_filescount so no debug info is lostserver/domain/tracker_service.pyparse_semver(manifest_version) > parse_semver(latest.semver)raisedValueErroron any malformed semver, aborting the whole tracker run_hint_is_higherhelper that catchesValueErrorand falls back to auto-bumpserver/infra/modal_client.pyuv syncalways exited 0 (last command wasecho), so a non-zero rc was silently lost; broken deps surfaced later as a confusing "agent crashed on import"uv sync's rc, raise on non-zero with a sanitized tail of stdout, trim the happy-path log to byte countfrontend/components/AskModal.tsxmessages/query/errorwere not reset when the modal reopened — stale conversation reappeared on reopenuseEffectclears state whenisOpenflips to trueConcrete failing scenarios these fix
version_hint: "v1.2.3"(with a strayv) in theirSKILL.md. The next tracker tick crashes inside the version-resolution branch withValueError: Invalid semver, the whole batch is logged as failed, and every skill in that repo stops getting picked up until the manifest is fixed. With this PR the bad hint is logged as a warning, the version falls back to auto-bump, and the rest of the batch continues.pyproject.toml(typo'd dep, deleted package).uv syncreturns rc=1, but the bash wrapper still exits 0. The sandbox proceeds to launch the agent, which immediately fails onimport missing_package, and the eval report shows "agent crashed" with no link to the real cause. With this PR the publish/eval surfacesRuntimeError: uv sync failed with exit code 1: <tail>so the cause is obvious.Tests added
server/tests/test_domain/test_tracker_service.py::TestHintIsHigher— 7 cases covering happy path, malformed hint, malformed current, both malformed, and the commonv-prefix mistake.server/tests/test_infra/test_modal_client.py::TestSandboxZipSlipProtection::test_raises_when_uv_sync_fails— patchessb.execto return rc=1 for theuv syncinvocation only; assertsRuntimeErroris raised with the expected message.frontend/components/AskModal.test.tsx— new "clears prior conversation, query, and error when reopened" case usingrerenderto toggleisOpen; asserts the previous answer, user message, and input value are all gone.Findings deliberately left for follow-ups
The deep review surfaced more than this PR fixes. Calling them out so they aren't lost:
server/domain/publish_pipeline.py(848 LoC) has no dedicated test file; error paths around S3 upload, version conflicts, and eval triggers are only covered indirectly via API tests.server/infra/cache.pyevicts the entry expiring soonest; under mixed-TTL workloads (taxonomy 10s, org metadata 30s) cold entries thrash. LRU/access-time would help but is not a clear bug today.generate_and_store_skill_embeddingwarns and returns; a publisher whose Gemini call failed has a skill that won't surface in semantic search and no signal in the response.last_commit_shaadvances and the failing skill never retries until the next push. Per-skill retry tracking is the right fix but is a larger design change.backfill_*.pylack--resumeand incremental flushing; a crash six hours into a 10k-skill backfill restarts from zero.fontSizein a few page components. Should use the--text-*scale per CLAUDE.md.Quality gates
ruff check/ruff format --check: cleanmypy(88 source files): cleantsc -b+eslint: clean (one pre-existing warning inSkillDetailPage.tsxnot touched here)Test plan
pyproject.tomlagainst dev — confirm the eval/publish error message namesuv syncinstead of a downstream import errorversion_hint: "v1.2.3"in a tracked manifest — confirm the tracker logs a warning and the rest of the batch publishes normallyhttps://claude.ai/code/session_012v9S3rfspyGQKLRXY3iTKc
Generated by Claude Code