fix(agent-challenge): stop public log redaction from wedging the event loop - #66
Open
echobt wants to merge 1 commit into
Open
fix(agent-challenge): stop public log redaction from wedging the event loop#66echobt wants to merge 1 commit into
echobt wants to merge 1 commit into
Conversation
…t loop _PUBLIC_SECRET_SEGMENT_RE nested (?:[A-Za-z0-9_.]+[-_.])* over a character class that also contained the separators _ and ., so any dotted or underscored run that never reached secret/token could be split in exponentially many ways. Measured on the live pattern: 37 characters took 23ms and 61 characters took 91s. Terminal-Bench task events carry pip output, which has exactly that shape, and get_submission_task_events replays them on an unauthenticated endpoint. One log line therefore pinned the validator event loop at 100% CPU, starved the evaluation worker, and left a job stuck running with no containers and no logs for hours. Redaction is now a single linear pass over delimited words plus two bounded marker checks, which keeps the previous redaction decisions unchanged: whole-segment token matches, tokens left alone, secret markers redacted.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe task-event text redaction path replaces a monolithic secret-matching regex with bounded candidate and marker checks. New tests cover dotted-input performance and preservation of non-secret identifiers in realistic pip output. ChangesPublic secret redaction
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
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.
Summary
Root cause
_PUBLIC_SECRET_SEGMENT_REnested(?:[A-Za-z0-9_.]+[-_.])*over a character class that also contained the separators_and.. Any dotted or underscored run that never reachedsecret/tokencould therefore be split in exponentially many ways before the match failed.Measured on the live pattern:
Terminal-Bench task events carry pip output (
Successfully installed agent-challenge-1.0.1 aiohappyeyeballs-2.7.1 ...), which is exactly that shape, andget_submission_task_eventsreplays it on an unauthenticated endpoint. One log line was enough to wedge the loop.Observed in production:
py-spyshowed the main thread parked in_public_task_event_text(routes.py:5108) withwchan=0, validator at 101% CPU, a job stuckrunningfor hours with no containers and no log events.Because the endpoint is public and unauthenticated, this was also a remote denial-of-service vector.
Changes
_PUBLIC_SECRET_WORD_RE(one linear pass over delimited words) plus two bounded marker checks.tokenredacted,count-dataset-tokensleft alone,secret/raw-ref/broker-ref/pod-markers redacted, surrounding text untouched.Test plan
test_public_task_event_redaction.py,test_frontend_api_contract.py,test_submission_status.py— 21 passed).mainreproduces the same 24 failures, so they are pre-existing and unrelated.ruff checkandruff format --checkclean.own-runner-task-*containers started within seconds and CPU settled at 6.6%.CI
Notes
Summary by CodeRabbit
Bug Fixes
Tests