Skip to content

feat(integrations): Notion live e2e + config-get fix + ntn pages argv fix (T4)#76

Merged
madarco merged 1 commit into
add-ticketing-integrationsfrom
agentbox/notion-t4
Jun 6, 2026
Merged

feat(integrations): Notion live e2e + config-get fix + ntn pages argv fix (T4)#76
madarco merged 1 commit into
add-ticketing-integrationsfrom
agentbox/notion-t4

Conversation

@madarco
Copy link
Copy Markdown
Owner

@madarco madarco commented Jun 6, 2026

Summary

Closes T4 of the Notion integration backlog (T1 #73, T2 #74, T3 #75 already merged into add-ticketing-integrations). T4 = live end-to-end verification + fix the bugs the e2e surfaces + close out the docs.

Two bugs surfaced and fixed by the e2e

1. agentbox config get couldn't read 3-level nested keys

agentbox config set --project integrations.notion.enabled true wrote correct YAML, and loadEffectiveConfig(cwd).effective.integrations.notion.enabled returned true, but agentbox config get integrations.notion.enabled returned <unset>. The leafValue / rawLeafFromValues helpers in apps/cli/src/commands/config.ts split on the FIRST dot only, so the deepest leaf was never reached. config set (packages/config/src/write.ts:setLeaf) and loadEffectiveConfig (packages/config/src/load.ts:readLeaf) split on ALL dots — asymmetric bug.

Fix: single walkKey(obj, key) helper that walks every segment (mirrors readLeaf's shape).
Regression test: new apps/cli/test/config-get-nested.test.ts covers plain, --json, --all, and unset-defaults; all four fail without the fix.

2. Connector buildArgv used singular page, real ntn uses pages

A live notion pages create through the host relay (built from T3 code) failed with:

error: unrecognized subcommand 'page'
  tip: some similar subcommands exist: 'update', 'pages'

Real ntn's surface (from ntn --help): api datasources files pages login logout whoami workers. The connector's buildArgv produced ['page', 'create', ...] (singular). Fixed in connectors/notion.ts; tests in packages/integrations/test/registry.test.ts and packages/relay/test/integrations.test.ts updated to assert the new argv.

E2E evidence captured

  • notion whoami → bot identity, no prompt (read).
  • notion api v1/users/me → JSON identity, no prompt (read).
  • notion api -X POST and --method PATCH → exit 65 with refuseApiNonGet message (write classified, refused before any host spawn).
  • printenv | grep -i notion → empty in the agent's process env. The carried ~/.config/notion/auth.json is for nested-box relay hosts, not the agent.
  • agentbox config get integrations.notion.enabled → now prints true (from: project ...) (was <unset> before the fix).
  • agentbox doctor[ ok ] notion ntn version ... · authed.

Live write round-trip — needs the host relay rebuilt with this PR

The host relay was rebuilt with T3 code before T4 started, so the prompted write test hit the bug (which is the evidence the bug exists). Once this PR merges and the host relay rebuilds, the prompted write path will work end-to-end. Confidence: (a) the failure mode matches the bug exactly, (b) /usr/bin/ntn pages create --help confirms the new argv is right, (c) unit tests pin the new argv.

Nested-box e2e — deferred

Architecturally, the in-box agentbox-ctl daemon (port 8788) forwards /rpc to the HOST relay (host.docker.internal:8787), so a nested box's notion pages create still terminates at the host relay's spawn — it doesn't exercise the connector code differently from the primary e2e. The carry block in agentbox.yaml is verified (~/.config/notion/auth.json present in this box). Tracked in docs/integrations.md under "Open follow-ups".

Docs closeout

  • docs/notion_backlog.md: T4 marked ✅ done with full evidence; new status-log entry.
  • docs/integrations_backlog.md: new ## Status section marks the Notion path complete (T1–T4); calls out deferred items (comment.add, host-initiated tokens for integrations, nested-box e2e).
  • docs/integrations.md: new ## Verification / live e2e results section between "Carry-based file-auth" and "Cross-provider parity".

Test plan

  • pnpm typecheck green (25/25 packages)
  • pnpm test green (494 + 217 + 174 + ... passing across 25 packages)
  • pnpm build green
  • Live read e2e captured (whoami, api/users/me, refusal)
  • No-token assertion captured
  • Live write e2e is the bug evidence (and will succeed after host relay rebuilds on merge)

Note

Low Risk
Targeted CLI config lookup fix, Notion argv correction, tests, and documentation; no auth or relay gate logic changes beyond the argv fix for host spawns.

Overview
Closes Notion T4: live read e2e evidence is captured in docs, and two bugs found during e2e are fixed in code.

agentbox config get now resolves dot-path keys by walking every segment via a new walkKey helper in config.ts, so keys like integrations.notion.enabled match config set / loadEffectiveConfig instead of splitting only on the first dot and showing <unset>. config-get-nested.test.ts locks in plain, --json, --all, and default fallback behavior.

The Notion connector’s page.create / page.update buildArgv now invokes ntn pages create|update (plural), matching the real CLI; integration and registry tests assert the updated argv.

Internal docs (integrations.md, notion_backlog.md, integrations_backlog.md) record T4 verification results, mark the Notion path complete, and note deferred nested-box e2e.

Reviewed by Cursor Bugbot for commit 6954e09. Configure here.

…argv fix (T4)

Two bugs surfaced by the live Notion e2e:

1. `agentbox config get integrations.notion.enabled` returned `<unset>`
   even though `config set` + `loadEffectiveConfig` worked. The CLI's
   `leafValue` / `rawLeafFromValues` helpers split on the FIRST dot only,
   so 3-level keys never reached the leaf. Replaced with a single
   `walkKey` helper that walks every segment (mirrors `readLeaf` in
   `packages/config/src/load.ts`). New regression test
   `apps/cli/test/config-get-nested.test.ts` covers the plain, `--json`,
   `--all`, and unset/default branches; all four fail without the fix.

2. The Notion connector's `buildArgv` produced singular `['page',
   'create', ...]` but real `ntn` uses plural `pages`
   (`api datasources files pages login logout whoami workers`). A live
   `notion pages create` through the host relay failed with
   `error: unrecognized subcommand 'page'`. Fixed in
   `connectors/notion.ts`; existing tests in `integrations/test/` and
   `relay/test/` updated to assert the new argv.

Live read e2e: `notion whoami` and `notion api v1/users/me` round-trip
through the in-box shim → host relay → Notion API with no prompt;
`notion api -X POST` and `--method PATCH` are refused via
`refuseApiNonGet` (exit 65); `printenv | grep -i notion` shows nothing in
the agent's env.

Closes T4. Nested-box e2e deferred — the in-box ctl daemon forwards to
the host relay, so a nested box's write still terminates at the host
relay's spawn, not exercising the connector code path differently;
tracked in docs/integrations.md.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentbox-web Ready Ready Preview, Comment Jun 6, 2026 9:35pm

Request Review

@madarco madarco merged commit 441d451 into add-ticketing-integrations Jun 6, 2026
4 checks passed
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