Skip to content

refactor: share the remaining small helpers between runtime, the Action and the gateway - #1888

Merged
marcusrbrown merged 9 commits into
mainfrom
refactor/shared-small-helpers
Oct 20, 2026
Merged

marcusrbrown merged 9 commits into
mainfrom
refactor/shared-small-helpers

Conversation

@marcusrbrown

Copy link
Copy Markdown
Collaborator

Problem

Copies of a few helpers were still live across runtime, the Action and the gateway:

  • the gateway's owner/repo#n entity-ref parser, three identical copies on the repo-access gate path;
  • four local sleep/delay helpers next to an unused runtime sleep;
  • five gateway logger adapters, two SHA validators and two binary-bytes formatters;
  • stale "mirrors" comments, one of which names a function that does not exist.

Change

  • Entity-ref parser. @fro-bot/runtime exports parseEntityRefRepo, pinned by a new test. The gateway's run-index lookup, redaction gate and run summary call it, and the copies and wrappers are deleted. The doc now says entity_ref is written as a bare owner/repo; the # strip only guards legacy or malformed records.
  • Sleep. Runtime server.ts, the Action's execute.ts and checkpoint.ts, and coordination-decline.ts use runtime sleep.
    • coordination-decline skips the wait for zero entries (if (delayMs > 0)), so its restore retries still run.
    • acquire-lock keeps its local unref delay, with a comment explaining why.
  • Gateway. There is now one toRuntimeLogger (execute/runtime-logger.ts, pinned by a new test), one workspace-api/sha.ts and one formatBinaryBytes. The stale comments are fixed.
  • Not shared. The gateway's run-timeout default stays a local DEFAULT_RUN_TIMEOUT_MS. It is the whole-run ceiling, a different setting from the Action's agent timeout, even though both are 30 minutes today.
  • Docs. The consolidation requirements mark config block 1 (feat: one object-store settings parser for the Action, gateway and backfill #1883) and this rung as delivered. They explain why GitHub App minting and the redaction wrappers are not small-helper merges, and link the two follow-ups:

Behaviour

No behaviour change for any input production passes. No existing test file was edited; the only test changes are the two new files.

One edge case: runtime sleep throws on negative, NaN or infinite delays, where the old local copies resolved. Only test-injected options can produce those values; the defaults are 100, 200 and 250 ms. The exported waitForServerQuiescence gets the same guard.

Verification

  • bun run check-types, bun run lint and bun run build pass, and dist/ is rebuilt.
  • Tests: runtime 1393, Action 2607, workspace-agent 773, harness 439, gateway 5431, evals 173, scripts 688.
  • Revert checks: dropping the # strip fails 4 of the 10 entity-ref tests, and mis-routing warning fails 2 of the 8 logger tests.

fro-bot
fro-bot previously approved these changes Oct 20, 2026

@fro-bot fro-bot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS

The helper extractions preserve production behavior. No introduced correctness, security, or public API compatibility issues identified.

Blocking issues

None

Non-blocking concerns

None

Missing tests

Optional: add fake-timer coverage for positive and negative label-restore backoffs. Existing tests cover zero-delay retries; the new parser and logger tests cover their important edge cases.

Risk assessment (LOW): likelihood of regression, security exposure, or blast radius

Mostly identical extractions, preserving authorization checks, SHA validation, log argument order, and byte formatting. Shared sleep rejects invalid intervals, but production callers use valid defaults or bounded values.

Static review only; no tests, build, lint, or type-check commands were run, as requested.


Run Summary
Field Value
Event pull_request
Repository fro-bot/agent
Run ID 39457085184
Cache hit
Session ses_ea5d9e827ffeODPdj20ymMyPdG

@fro-bot fro-bot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS

Re-reviewed d2f19ac against the previously approved head. The only addition is backoff test coverage, which addresses the prior optional feedback: positive-delay timing, immediate negative-delay retries, and mixed sequencing.

Blocking issues

None

Non-blocking concerns

None

Missing tests

None

Risk assessment (LOW): likelihood of regression, security exposure, or blast radius

Production code is unchanged since the prior review. The new tests check retry timing and successful label restoration, including protection against swallowed errors.

Static review only; no tests, build, lint, or type-check commands were run, as requested.


Run Summary
Field Value
Event pull_request
Repository fro-bot/agent
Run ID 39461484267
Cache hit
Session ses_ea5d9e827ffeODPdj20ymMyPdG

@marcusrbrown
marcusrbrown enabled auto-merge (squash) October 20, 2026 17:35

@fro-bot fro-bot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS

Validated merge commit bec7576 against previously approved d2f19ac. The only incoming change is a runner-hardening action pin update matching main. The reviewed helpers, tests, documentation, and bundles are unchanged; no merge-resolution changes were found.

Blocking issues

None

Non-blocking concerns

None

Missing tests

None

Risk assessment (LOW): likelihood of regression, security exposure, or blast radius

The merge introduces no changes to the previously reviewed implementation or test coverage. Prior approval remains applicable.

Static review only; no tests, build, lint, or type-check commands were run, as requested.


Run Summary
Field Value
Event pull_request
Repository fro-bot/agent
Run ID 39467430994
Cache hit
Session ses_ea5d9e827ffeODPdj20ymMyPdG

@marcusrbrown
marcusrbrown disabled auto-merge October 20, 2026 17:39
@marcusrbrown
marcusrbrown merged commit cc35481 into main Oct 20, 2026
15 checks passed
@marcusrbrown
marcusrbrown deleted the refactor/shared-small-helpers branch October 20, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants