Repository navigation
Conversation
- Tighten Landlock startup detection so compiler diagnostics mentioning landlock_ruleset stay ordinary task failures; exclude path:line compiler lines from startup pattern matching. - Restrict nono startup detection to session/snapshot creation phrases and gate it on a fast exit or empty stdout so mid-run nono errors are not misclassified as harness unavailability. - Redact credentials in agent exit reasons and startup-failure reasons before they reach ticket comments, Sentry, or runs.outcome_reason. - Add regression tests for the compiler line, mid-run nono failure, genuine landlock failure, and token redaction. Iteration 2 fixes: - Redact agent-derived reasons with redactText + redactSecrets (worker-logs) plus GitLab/npm/Google token shapes, so tracker comments and runs.outcome_reason never carry AWS, Slack, JSON password, or PEM secrets. - Make the compiler-diagnostic matcher space-tolerant so paths such as "/Users/John Smith/..." do not turn a failed compile into a startup failure. - Remove the broad landlock pattern and gate landlock detection on a fast exit or empty stdout, so mid-run test/build output mentioning landlock stays an ordinary task failure. - Report the line that matched a startup pattern instead of the first stdout line, so the failure reason and Sentry event name the real cause. - Add regression tests for spaced paths, mid-run landlock output, reason-line selection, and AWS/Slack/JSON credential redaction. Iteration 3 fixes: - Anchor extra token redaction patterns with lookarounds instead of \b so GitLab/Google tokens ending in "-" or "_" are still masked before reaching ticket comments and runs.outcome_reason. - Base the landlock/nono startup gate on combined stdout+stderr output and a 30s exit window, so stderr-only mid-run diagnostics are not misclassified while a banner-prefixed startup failure after 2s still is. - Narrow the "pat" secret-key alternative so path/patch/compatible are no longer redacted, keeping nono path_not_granted reasons intact. - Rewrite compiler-diagnostic tests to exercise the diagnostic filter with an open startup gate, and add regressions for trailing "-"/"_" tokens, stderr-only mid-run landlock output, banner-prefixed slow startup failures, and ordinary "pat" words. Iteration 4 fixes: - Remove the lookbehind from the "pat" secret-key alternative so camelCase and all-caps keys (clientPat, userPat, MYPAT) are masked again, while path/patch/ compatible stay untouched because the lookahead already rejects those. - Drop the unreachable !hasAgentOutput gate clause and document that landlock/nono signals are gated on the 30s exit window; a stderr-only mention past the window is an ordinary task failure by design. - Add regression tests for camelCase/uppercase "pat" keys and the inclusive 30s startup-window boundary. Iteration 5 fixes: - Gate mise/EACCES/ENOENT/"Permission denied (os error 13)" startup patterns on the same 30s window as landlock/nono, so a long agent run that merely prints an npm/node OS error is no longer reclassified as "harness unavailable" (which suppressed the failure comment, retry state, and the real failure). - Apply the compiler-diagnostic filter to the <=2s no-output heuristic and to the reason it reports, so tsc/eslint-style output cannot become a startup failure with its diagnostic line as the reason. - Reject whole lines of bare base64/PEM key material and mask inline MII-prefixed DER bodies before they reach runs.outcome_reason or a tracker comment; prose lines containing spaces stay selectable. - Add regressions for 20-minute runs printing ENOENT/EACCES/os-error-13/mise denials, a 1.2s compiler-diagnostic failure, and lone/inline PEM key bodies.
Artifacts & verificationRun: 26 · Commit: Change explanationProduced by No PR template exists under Explain: Sentry DEVINTERN-H, "Agent exited with code 1"Why this change is neededThe task provides only the Sentry grouping: an Recorded reproduction (verification step): running What changed1. Make non-zero exits attributableA new 2. Make startup classification narrower and more exact
Compiler diagnostic lines ( 3. Redact agent-derived text before it leaves the process
4. Reduce a shared redaction false positive
5. TestsNew and extended tests cover: nested-nono startup classification, compiler diagnostics naming landlock (including paths with spaces), mid-run landlock/nono output, the 30-second gate boundaries, selection of the matched startup line, redaction of credentials in reasons, ANSI stripping and truncation, bare-key-material rejection, the enriched exit error, and the Validation actually performedObserved, from the pipeline evidence:
Not observed:
Material risks
Where reviewers should focus
Suggested checks not yet recorded: replay a long agent run that prints Visual explanationProduced by Show artifactSummaryThe task is to reproduce and fix the root cause behind Sentry group DEVINTERN-H, EvidenceRecorded in the pipeline evidence (not re-run here):
Before/after execution results were not captured in the evidence. There is no end-to-end replay of a real failing agent run, no live Sentry event check, and no rendered tracker-comment check. Auto-review did not converge: Merge DangerRevert is mechanically simple: no schema or migration changes, and the enriched error text is only consumed as opaque text at four sinks — console, Blast radius is control flow, not just messaging. Safe to ship without a staged rollout because it is confined to failure handling and nested sandboxing is already blocked earlier by Verification reportProduced by Show artifactFurther artifacts omitted because they exceed the comment preview budget. |
Why
Task devintern-public-devintern-h: Fix Sentry error
The Sentry group records
Agent exited with code 1fromrunAgentHarnesswith no explanation. The known infrastructure cause — a nestednonosandbox failing before the agent starts — was already guarded in the sandbox resolver, but the failure path still had two gaps: somenonosession/capability startup errors were not recognized, and any remaining non-zero exit discarded stdout/stderr entirely, leaving every distinct cause collapsed into the same unattributable Sentry event.Reproducing a nested
nono runin this environment producednono: Snapshot error: Failed to create session directory ... Permission denied (os error 13). The classifier now handles that failure shape regardless of the OS error wording, and ordinary agent failures carry their actual reason instead of only an exit code.What changed
packages/code/src/lib/agent/harness-startup.tsnonosnapshot/session/capability errors andlandlockruleset/namespace creation failures.describeAgentExitFailure, which selects the last failure-shaped stderr line (falling back to the last stderr/stdout line), strips ANSI codes, and caps the reason at 300 characters.packages/code/src/lib/agent/run-harness.tsAgent exited with code N: <reason>instead of the bare exit code.packages/code/tests/harness-startup.test.tspackages/code/tests/run-harness.test.tsScope
Included: startup-failure classification and non-zero exit diagnostics for implementation agent runs. Excluded: sandbox nesting policy, usage-limit detection, max-turns handling, delivery/PR behavior, and review-agent failure reporting (which is a separate path).
Tradeoffs
Appending the failure reason changes the Sentry event title/grouping for ordinary agent exits, which is intentional because it separates distinct causes. Only the most relevant single line is included rather than the full transcript, keeping events bounded and avoiding a large unredacted payload; Sentry’s existing redaction still applies. The added
nonopatterns are scoped to wrapper-prefixed startup errors and do not reclassify ordinary tool failures after the agent has run.Blast Radius
runAgentHarnessis used by every implementation pipeline run, so the improved error reaches ticket failure comments, run records, CLI output, and Sentry capture.detectHarnessStartupFailureconsumers now recognize more nested-sandbox startup failures asHarnessUnavailableError, allowing worker failover/defer instead of spending a task attempt. Review/CI-fix runs, sandbox provider selection, and successful runs are unchanged.Verification
nono runreproduction in this environment returnednono: Snapshot error: Failed to create session directory ... Permission denied (os error 13).bun run test harness-startup.test.ts run-harness.test.tsinpackages/code— 65 passed, 0 failed.bun run testinpackages/code— 2531 passed, 0 failed across 168 files.bun run typecheckinpackages/code— clean.bunx oxfmt --checkandbunx oxlinton all four changed files — clean.git diff --check— clean.nonoreleases.This PR was automatically created by @devintern/code