Skip to content

refactor(addie): extract neutral request tool assembly - #7299

Merged
bokelley merged 3 commits into
mainfrom
conductor/addie-direct-replay-contract
Sep 5, 2026
Merged

bokelley merged 3 commits into
mainfrom
conductor/addie-direct-replay-contract

Conversation

@bokelley

@bokelley bokelley commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • extract Addie global/request-local custom-tool definition and handler-map assembly into a typed neutral helper
  • preserve the legacy observable order: two handler-allowlist reads, requestTools.tools, the third definition-allowlist read and merge, then requestTools.handlers
  • keep global definition position, request-local last-winner behavior, ordinary wire shape, and the optional fifth materialized handler-allowlist argument

Regression evidence

  • independent old-vs-prior-helper reproducer: a Proxy-backed requestTools.tools getter changes the third allowlist from alpha to beta; legacy output is definitions [beta] plus handlers [alpha] (no executable intersection), while the prior helper made [alpha] executable
  • regression tests assert the full Proxy/getter sequence, that cross-mutation executable registry, and a third-read throw after definitions but before handlers
  • the helper now accepts only a structural definition-allowlist source and a materialized handler set. It invokes neither callbacks nor handlers and grants no authority.

Verification

  • focused single-worker suite: request-tool assembly, Claude client, replay, direct-Slack, and tool-wire-shape: 14 files / 199 tests passed
  • npm run typecheck passed
  • npm run build:addie-tools and npm run test:addie-tools passed; generated inventory is current
  • npm run validate:addie-fixed-traces completed for the unchanged 82-case corpus; npm run test:addie-fixed-traces was run in the same single-worker configuration
  • git diff --check passed

Hook note

The full server-unit precommit hook recorded unrelated failures in tests/unit/billing-admin-tenant-boundary.test.ts and tests/unit/authorization-epoch-session.test.ts; it was stopped after five minutes and replaced with the focused affected-suite rerun above. The repository hook explicitly permits the bounded HUSKY=0 bypass used for this commit.

Scope

This remains unauthenticated data assembly only. It introduces no replay authority, admission mechanism, provider invocation, handler dispatch, or fixed-trace connection.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 5, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ladon verdict: Approve

Approve — clean extract-function refactor with no blocking or medium findings.

What I checked:

  • Tool/handler merge-and-filter logic lifted from AddieClaudeClient.prepareFirstInvocation into a new assembleAddieRequestTools module; behavior verified identical (global-first ordering, request-local last-winner dedup, and allowedToolNames filtering on both tools and handlers all preserved).
  • 9 covering unit tests added for the extracted branch.
  • No wire/schema surface touched (static/schemas/source/** untouched) — no changeset owed, no oneOf/discriminator impact, no released-artifact modification.
  • high_risk is true only because files match server/src/addie/**; request-tool-assembly.ts is (added) and the two (modified) files (claude-client.ts, the generated inventory JSON) carry no medium-or-higher findings, so the modifications are presumed contract-preserving. New/modified high-risk files alone are not escalation-worthy.
  • No no-auto-approve team match; gated_paths is false, so row 2 does not apply despite review_decision: REVIEW_REQUIRED.

No findings at any severity. Rows 1–8 do not fire; falls through to row 9 → approve.

@bokelley
bokelley marked this pull request as draft September 5, 2026 19:41

bokelley commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Independent Sol/medium exact-head review found one blocking parity defect: accessor-backed allowedToolNames can gain an executable handler because the extraction changed the legacy read sequence. This PR is draft while a narrow Terra/high repair adds exact parity coverage. No replay authority or paid call is enabled.

@bokelley
bokelley marked this pull request as ready for review September 5, 2026 20:05

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ladon verdict: Approve

Approve — clean pass on the delta since the prior approve.

This PR extracts the inline global/request-local tool-assembly logic from claude-client.ts into a neutral request-tool-assembly.ts helper. The reviewer confirms the extraction is byte-for-byte equivalent (definition merge order, same-name winner, allowlist filtering, and the three-read allowedToolNames getter semantics all preserved and pinned by new parity tests). Scope is Addie/server-only — no schema (static/schemas/source/**), docs, dist artifacts, changeset, or governance gate in play.

Notes on gates:

  • No critical/high findings (rows 1 skipped).
  • gated_paths: false (row 2 N/A) — the REVIEW_REQUIRED status does not gate a non-gated diff.
  • high_risk: true but reasons are one (added) file plus two (modified) files with zero medium-or-higher findings, so rows 3/4/5 do not fire. New/modified high-risk files with no reviewer concern are presumed safe.
  • Prior decision was approve, so row 6 (sticky escalate) is inapplicable.
  • No no-auto-approve team match (row 7 N/A) and zero medium findings (row 8 N/A).

Falls through to row 9 → approve.

@bokelley
bokelley force-pushed the conductor/addie-direct-replay-contract branch from eda2b76 to b0b07c9 Compare September 5, 2026 20:22
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 5, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ladon verdict: Approve

Approve — clean pass, no blocking or medium findings.

This PR extracts the tool/handler merge logic from claude-client.ts into a new request-tool-assembly.ts in a behavior-preserving refactor. Parity tests pin the two-allowlist split (definition array vs. handler Set) and the sequential option read-order. Import cleanup, the generated inventory JSON, and REGISTRATION_SOURCES are consistent. No protocol/schema/docs/dist surface is touched, so no changeset is owed.

Decision-table walk:

  • Row 1 (critical/high): no findings — skip.
  • Row 2 (gated paths): gated_paths is false, and review_decision is APPROVED — skip.
  • Row 3 (deletion in high-risk path): high_risk is true but reasons are only (modified)/(added), no (deleted) — skip.
  • Rows 4–5 (medium findings): none — skip.
  • Row 6 (sticky escalate): prior decision was approve — skip.
  • Row 7 (no-auto-approve team): no team match — skip.
  • Row 8 (≥3 medium): zero medium findings — skip.
  • Row 9: approve.

high_risk is true only because files match server/src/addie/**, but all changes are (added)/(modified) with no reviewer concerns — normal work on a sensitive path, not escalation-worthy. Net improvement over the prior approve with no regressions introduced.

@bokelley
bokelley marked this pull request as draft September 5, 2026 20:28
@bokelley
bokelley marked this pull request as ready for review September 5, 2026 20:50
@bokelley
bokelley enabled auto-merge (squash) September 5, 2026 20:50

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ladon verdict: Approve

Approve — behavior-preserving refactor with no blocking or medium findings.

This subsequent pass extracts Addie global/request-local tool assembly into the neutral helper assembleAddieRequestTools. The reviewer traced the extraction against the original caller and confirmed value and observable-access-order parity (two handler-allowlist reads, requestTools.tools, third definition-allowlist read/merge, then requestTools.handlers). The two large delta files are exhaustive Proxy-sequence tests, not source logic. No protocol surface (static/schemas/source/**, docs/reference/**, dist/**) is touched, so changeset/oneOf/immutability/schema-drift concerns do not apply.

Decision table: no critical/high findings (row 1 n/a); gated_paths is false (row 2 n/a); high_risk is true but reasons are (modified)/(added) with no (deleted) and no medium findings, so rows 3–5 don't fire; prior decision was approve, so row 6 sticky-escalation n/a; no no-auto-approve team match (row 7 n/a); zero medium findings (row 8 n/a). Falls through to row 9 → approve. This is consistent with the prior approve on the earlier head.

@bokelley
bokelley merged commit a7e1b26 into main Sep 5, 2026
30 checks passed
@bokelley
bokelley deleted the conductor/addie-direct-replay-contract branch September 5, 2026 20:54
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.

1 participant