Add captcha task-start and challenge-result events - #332
Open
archandatta wants to merge 6 commits into
Open
Conversation
archandatta
force-pushed
the
archand/kernel-1772/captcha-solve-started-schema
branch
from
August 18, 2026 13:40
d38c3e5 to
e6ff096
Compare
Introduce a captcha_solve_started event in the captcha category, emitted when a solver accepts a task so consumers can react to a solve in flight rather than only seeing the terminal captcha_solve_result. Factor the captcha_type enum into a shared BrowserCaptchaType schema referenced by both event payloads, and add press_and_hold to it to cover the in-VM vision solver, which already emits that value. Schema and regenerated code only; producers land separately.
The captcha events are per solver task, so an image-grid challenge that retries emits one event per round with nothing tying the rounds together. challenge_id groups them; task_id stays per task.
captcha_solve_started and captcha_solve_result describe one solver attempt each, and a single visible challenge takes several: an image grid retries with a fresh task per round. Nothing in either event says a challenge is over, and challenge_id only makes the attempts groupable. captcha_challenge_result is emitted once per challenge by a producer watching the page, which is the only vantage point that can observe the response token. status is what the page saw — solved or abandoned — and solved describes the challenge, not the flow around it, since a site can still reject a valid token.
archandatta
force-pushed
the
archand/kernel-1772/captcha-solve-started-schema
branch
from
August 18, 2026 18:50
b451071 to
381cc60
Compare
Sayan-
marked this pull request as ready for review
August 18, 2026 19:44
Sayan-
reviewed
Aug 18, 2026
Sayan-
left a comment
Contributor
There was a problem hiding this comment.
Wire format is additive and safe: the new types land in a taxonomy-only union and challenge_id is optional. Two things I'd still fix.
- Build break downstream. This deletes
BrowserCaptchaSolveResultEventDataCaptchaTypeand its constants, and renames the status constants fromSuccess/Failure/Timeout/Abandonedto prefixed forms.kernel/kerneluses both inpackages/metro-api/lib/capmonsterrelay/relay.go, line 332 for status and line 363 fornormalizeCaptchaType's signature and returns. metro-api resolves that import through areplaceonto the internal mirror, so it breaks on the next sync plus module bump rather than at merge. Worth a companion PR landed first.
The status rename also looks unintentional. oapi-codegen only dropped the prefix because nothing collided; removing the captcha-type enum changed the collision set.
captcha_challenge_result.statusissolved/abandonedonly, so a solver hard-failure and a dismissed widget are indistinguishable. Addingfailureortimeoutlater means widening a shipped SDK enum, which is the thing the rest of this PR is careful to avoid.
Nits: data is optional on the event, so required challenge_id isn't enforced. duration_ms is optional here but required on the task result.
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
captcha_solve_startedfor task acceptance andcaptcha_challenge_resultfor the overall visible-challenge outcomeBrowserCaptchaTypeacross captcha events, including the existingpress_and_holdwire valuetask_idcorrelation andchallenge_idgrouping, withchallenge_idrequired on challenge resultsContract
captcha_solve_startedrecords that a solver accepted one task. It does not assert that the solve is still running when a consumer receives it: delivery is asynchronous, a start can arrive after its result, and either event can be missing.When present,
task_idcorrelates one start with its terminalcaptcha_solve_result.duration_mson the task result remains the authoritative task timing.challenge_idgroups multiple tasks from one visible challenge, such as image-grid retries, without indicating task ordering or completion.captcha_challenge_resultis emitted once for the overall challenge, requires that grouping key, and reportssolvedorabandoned. Asolvedchallenge issued a response token; it does not prove that the surrounding site flow accepted the token or succeeded.Existing
captcha_solve_resultbehavior is unchanged apart from the optional grouping field and shared captcha-kind schema.Rollout
This change defines the schema and generated image API types only. Mirror the two new event types and shared captcha taxonomy into the public API and SDKs before any producer begins publishing them; producer changes follow separately.
Testing
go test -race $(go list ./... | grep -v /e2e$)— passgo build ./...— passgo vet ./...— passgit diff --exit-code— cleanlatestchecksum manifest no longer contains the pinnedffmpeg-n7.1archiveNote
Medium Risk
Contract and generated-type changes affect telemetry consumers and future producers; correlation semantics are easy to misuse if mirrored incorrectly in SDKs.
Overview
Extends browser captcha telemetry with
captcha_solve_started(solver accepted a task) andcaptcha_challenge_result(one terminal outcome per visible challenge:solvedorabandoned). The OpenAPI spec and generatedoapitypes wire both into the known telemetry union and map them to the captcha category.Introduces shared
BrowserCaptchaType(includingpress_and_hold) andBrowserCaptchaChallengeIDfor grouping retries.captcha_solve_resultnow uses that shared type, may carry optionalchallenge_id, and documents thatduration_msis authoritative andtask_idpairs with the matching start event when present—not arrival order.Adds
TestCaptchaCategoriessocaptcha_solve_startedandcaptcha_challenge_resultresolve to the captcha category. Schema-only in this PR; producers are expected to adopt publishing separately.Reviewed by Cursor Bugbot for commit 978faed. Bugbot is set up for automated code reviews on this repo. Configure here.