Repository navigation
[local-onboarding-try-it-on-this-repo-first-sug] Onboarding: try it on this repo first (suggested tasks, free first run) - #846
Open
danii1 wants to merge 4 commits into
Conversation
…arding: try it on this repo first (suggested tasks, free first run)
Unwrap a harness JSON envelope (string `result`) in parseSuggestions; test added.
Contributor
Author
Artifacts & verificationRun: 1701 · Commit: Verification reportProduced by Show artifactAuto-review summaryProduced by Show artifact |
…-picker-defaults-and-r' into feature/local-onboarding-try-it-on-this-repo-first-sug # Conflicts: # packages/code/src/lib/init/wizard.ts # packages/code/src/lib/init/worker-init-noninteractive.ts
Contributor
Author
|
🔀 This branch had merge conflicts with |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Why
Stacked on #843 (
feature/local-onboarding-tracker-picker-defaults-and-r, task local-onboarding-tracker-picker-defaults-and-r): this PR targets that branch. Review and merge #843 first.Task local-onboarding-try-it-on-this-repo-first-sug: Onboarding: try it on this repo first (suggested tasks, free first run)
A person without a tracker token had to sign in for the Worker Pilot before the worker ran anything, and the first run was a CONTRIBUTING.md note that showed nothing of the product's value. Now the first task can be a real one from their repo, run in the foreground with no sign-in, and the sign-in comes only after they have seen a result.
What changed
wizard.tsanddefault-tracker.tsadd "Try it on this repo first (no tracker needed)". It becomes the Enter default only when no GitHub/GitLab token matches. It is Markdown underneath, with the folder~/.devintern/try/<repo>/tasks.devintern initdoes not show it.try-mode.tsandtry-runtime.tsrun the user's own agent once in the harness's native read-only mode, under the configured sandbox, with a 180s limit. It asks for 3 tasks (title, what and why, files, acceptance) and writes them asstatus: todofiles.git statusdiffers after the scan.worker-init-try.tsis a newtrystep aftertracker. It shows the titles, and Enter picks the first. It then runsdevintern <task file> --create-pras a child process with the terminal attached, so it is the ordinary interactive run with the ordinary licence decision.devintern worker initand ends with exit code 0.worker init --non-interactive --tracker trywrites the suggested tasks and returns them in an additivetrialfield plus arun-first-tasknext step. It never runs them. I chose--tracker tryover a flag onmarkdownbecause it matches the picker entry and needs no new flag.planTrackermoved intoworker-init-noninteractive-tracker.ts.defaultEnsureTrackernow takes an options object as its last argument; three existing test call sites were updated.worker/cli.tswires the real runners.suggestmode and a clarity reply.docs/code/quick-start.mdanddocs/code/markdown-tasks.mdare updated.Changes after review
Auto-review fix 1:
parseSuggestionsinpackages/code/src/lib/init/try-mode.tsnow unwraps a JSON envelope. If the parsed object has notasksarray but a stringresultfield, it parses that string for suggestions, at most 2 levels deep. Other envelope shapes still fall back to the CONTRIBUTING sample.normalizeEntrieshelper to bring it back under.packages/code/tests/try-mode.test.tshas a new case where the{tasks}JSON sits inside an envelope'sresultstring. It expects 3 suggestions.runReadOnlyScanintry-runtime.tsdoesn't setstructuredOutputorstreamEvents. Those are opt-in flags inpackages/agent-harness/src/types.ts:85-100, which produce the JSON output. So stdout should be plain text, which the existing parsing already handles. I didn't run any real harness to check this.Findings addressed:
parseSuggestionstakes the first{to the last}of the raw scan stdout. If the real harness invocation (buildHeadlessAgentInvocationinagent/spawn.ts, called fromtry-runtime.ts) emits a JSON or stream-JSON envelope with the answer as an escaped string, the outer object has notasksarray. Parsing then yields nothing, and try mode silently falls back to the CONTRIBUTING sample on every real run. The e2e fake agent prints the raw{tasks}JSON, so the tests never exercise a wrapped envelope. I did not verify the real output format of each harness. inpackages/code/src/lib/init/try-mode.ts:108-135Scope
worker init) is not implemented.defaultEnsureTrackerskips the picker once the workspace.envnames a tracker. The workspace step also refuses a tracker change once a query is saved. Making it work needs a separate change, so the end-of-try text points to the docs instead.Tradeoffs
process.execArgvto it. The cost is that the run has no live handle in the wizard, and its output is raw.isAutomatedEnvironmentbefore spawning, so in CI or a systemd service it prints the command and runs nothing. Only theisAutomatedEnvironmentclassification is covered by unit tests; the refusal-before-spawn behaviour is covered by e2e.statusofftodo, as the e2e shows.worker-init-wizard.test.tsand the golden path used Enter to mean Markdown. The first now typesmarkdown; the golden path already did.Blast Radius
worker initpicker (a new first entry, new Enter default when untokened),defaultEnsureTracker's signature, and the flags-mode--trackerparsing (tryis new).tryModeabsent (every unit test that injectsensureTracker), the picker and defaults are as before. Other trackers,devintern init, existing JSON fields and exit codes are unchanged. The JSONtrialfield and therun-first-taskstep are additive.worker initnow exits 0 when the user declines the worker after a try run. A shellMARKDOWN_TASKS_DIRor an already-saved one wins over the try folder, so tasks may land there instead.trackWorkerInitCompletedwith the tracker as "markdown".Verification
Checks a later pass could not run or bypassed (no later pass reports them):
Auto-review fix 1: Typecheck, lint (including knip and the ratchet) and format all passed. These ran as part of the lefthook pre-commit hook. I didn't use
--no-verify.Auto-review fix 1: The only thing not run was a real harness invocation, so the actual stdout format of each agent is unverified.
bun run typecheck: pass.bun run lintfrom the repo root (oxlint, knip, lint-ratchet): pass, after splitting the plan file, an options object fordefaultEnsureTracker, and an extracted helper to stay under the ratchet limits.bun run testinpackages/code: 6544 pass, 7 skip, 0 fail. This includes the newtests/try-mode.test.ts(scan fallback, folder location, interactive-run classification) and the default-tracker cases.After
bun run build, inpackages/e2e:worker-init-try.test.ts,worker-init-wizard.test.tsandworker-init-noninteractive.test.tsrun together as 29 pass, 0 fail. The new try tests cover:--tracker trywith the JSON result.I did not run the rest of the local e2e suite or the opt-in suites, and I did not test against a real agent or a real GitHub token. The foreground run in e2e used the fake agent and a local bare remote (no PR was created).
I did not commit anything.
Verification after review
Later entries supersede earlier results for the same check.
Auto-review fix 1:
bun run test tests/try-mode.test.tsinpackages/code: 15 pass, 0 fail, including the new wrapped-envelope case.--no-verify.🤖 Opened by DevIntern from local-onboarding-try-it-on-this-repo-first-sug