github-permission-singleflight: GitHub permission singleflight #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/github-permission-singleflight"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Assigned idea
Benchmark authoring specification.
Summary: Add deterministic singleflight behavior to the sidepanel GitHub API permission helper so concurrent callers share one Chrome permission request and all receive the same boolean result.
Task intent: Improve the existing upstream sidepanel permission helper in
entrypoints/sidepanel/github-permission.tsso repeated simultaneous calls torequestGitHubApiPermission()do not trigger multiplechrome.permissions.requestprompts for the same GitHub API origin.Benchmark plan: Construct the task package from commit
a4939d22bb1e69a7cea56d735b66259b37eb8cc5. The solver-facing work should ask for a small upstream change toentrypoints/sidepanel/github-permission.ts: keep the current originhttps://api.github.com/*, keep the fast path when permissions are already granted, preserve the current permissive behavior when the Chrome permissions API is unavailable, and add module-level in-flight request sharing for concurrent calls. The package should include hidden tests that exercise the exported function under mockedchrome.permissions.containsandchrome.permissions.requestimplementations.Environment plan: The task environment should be a normal checkout of
zhu1090093659/deepseek-ppat the specified commit with repository dependencies installable as usual. The separate verifier environment should not rely on a real browser extension runtime; it should run mocked Chrome permission objects from Python/Node-driven tests against the TypeScript source.Verifier plan: Create
test_outputs.pyto inspect and executeentrypoints/sidepanel/github-permission.ts. The verifier should run concrete checks equivalent to: 1) withchrome.permissions.containsresolving true, three calls return true andrequestis never called; 2) withcontainsresolving false and three calls started before the firstrequestresolves,containsmay be called per caller butrequestis called exactly once and all callers resolve to true; 3) when that single request resolves false, all concurrent callers resolve false; 4) after the in-flight request settles, a later call may issue a new request if permission is still not contained; 5) whenchrome.permissionsor its required methods are absent, the function still resolves true. The verifier should fail if the origin differs fromhttps://api.github.com/*or if the implementation serializes by returning stale results forever.Oracle plan: The oracle solution should edit
entrypoints/sidepanel/github-permission.tsby adding a module-scopedlet pendingGitHubApiPermissionRequest: Promise<boolean> | undefinedor equivalent. Aftercontainsreports false, reuse the pending promise if present; otherwise callchrome.permissions.request({ origins }), store that promise, catch failures as false, and clear the pending reference infinally.Difficulty plan: Current coding assistants may add a cache that permanently remembers denial or approval instead of only deduplicating in-flight prompts, may accidentally change the GitHub API origin string, may remove the non-browser fallback that returns true, or may only add static structure without correctly sharing concurrent asynchronous calls.
Repo patch scope: Expected upstream edits are limited to
entrypoints/sidepanel/github-permission.ts; verifier-only files may live outside the repo patch and should not be part of the proposed upstream change.Anti-leakage notes: Do not expose solver-facing benchmark, harness, Snorkel, Harbor, std-ts, agent, stage, attempt, retry, generated task, or evaluation context. Present the work only as a normal repository improvement.
Approach: Use the existing exported helper as the sole behavior target and add a narrow singleflight guard around the permission request path while preserving current API shape and fallback semantics.
Verification: Run the hidden
python test_outputs.pyverifier, which should mock Chrome permissions and assert the concrete concurrent-call behaviors forentrypoints/sidepanel/github-permission.ts.Risk: The main risk is that the repository may not already have a TypeScript test runner configured, so the verifier should be self-contained and mock browser globals rather than depend on extension tooling.
Path rules: task package is tasks/; mutable upstream checkout is tasks//task/environment/repo; benchmark package files are under tasks//task; verifier/container environment belongs under tasks//task/environment; regular and UI verifier logic belongs in task/tests/test_outputs.py and test.sh only runs that file through pytest.
Agent context
Task slug: github-permission-singleflight
Branch: task/github-permission-singleflight
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.