Harden tool contracts after long-running agent session - #12
Merged
Conversation
halqme
marked this pull request as ready for review
August 12, 2026 06:36
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
This PR turns repeated failures observed in a long-running Luna session into explicit tool and delegation contracts instead of relying on the model to infer them.
inspect_manya true read batch across files, while keepingreplace_manysingle-filedelegate-taskMotivation
The session completed successfully because the harness kept driving implementation and verification to completion, but it also exposed systematic errors that brute-force retries do not solve well: Astrolabe read-side protocol surprises, hidden Agent-Team tool constraints, and incorrect attribution of shared-worktree file changes to a child writer.
These are deterministic contracts, so they should be made explicit or enforced by the harness/tooling rather than left to model capability.
Changes
Astrolabe
inspect_manynow reads selected continuations concurrently even when they span files. It proposesreplace_manyonly when every selected target belongs to one file, preserving the existing single-file mutation contract.invalid_continuation; explicit deletion, path clearing, and session shutdown still invalidate it.locatedeclaration scope,inspectpath/continuation distinction, cross-file batch-read behavior, andmaxCandidatesrange visible to the model.no_candidatesalso points tosearchor ordinary text retrieval whenlocateis the wrong primitive.Agent-Team
Delegation
delegate-tasknow states that a file-change notification in a shared workspace is evidence that the workspace changed, not writer provenance. Ownership violations require attributable evidence; otherwise concurrent writers must be serialized or isolated.CI
packageManagerand exposes a singlecheckcommand.bun run checkruns root Oxlint and then every workspace's existingcheckscript sequentially. This keeps each workspace's own test-runner contract while avoiding interference between process-heavy test suites.main, installs Node 24 and Bun, performs a frozen-lockfile install, and executes the root check.background-processnow invokes its declaredtestscript fromcheck, so its detached-process lifecycle tests execute under Node as intended rather than inheriting the Bun test runner.planextension opts out of the shared Node global type set because it does not use Node globals; this removes an otherwise undeclared@types/noderequirement from that workspace.format:checkis available separately but is not part of the required CI gate yet; formatting remains handled by the repository's existing formatter/pre-commit convention.Verification
Regression coverage added for:
inspect_manywithout a cross-file mutation suggestiondelegate-taskevalsThe PR diff was reviewed against current
main, including removal of an unrelated test change introduced while editing. The Agent-Team schema change was checked against Pi v0.84.1'sStringEnumcontract.GitHub Actions CI now passes on this PR. The successful run performs a frozen Bun install, root Oxlint, and every workspace's existing
checkscript, including 69 passing Astrolabe tests and 12 passing Agent-Team tests.