Skip to content

feat(runtime): add requestData and requestManualAction APIs (design spec inside)#102

Draft
tnunamak wants to merge 4 commits intomainfrom
feat/interaction-api-redesign
Draft

feat(runtime): add requestData and requestManualAction APIs (design spec inside)#102
tnunamak wants to merge 4 commits intomainfrom
feat/interaction-api-redesign

Conversation

@tnunamak
Copy link
Copy Markdown
Member

@tnunamak tnunamak commented Mar 27, 2026

Summary

Adds requestData and requestManualAction to the connector page API, each returning an InteractionResult ({ status: "success", data? } | { status: "skipped", reason }). Old APIs (requestInput, promptUser, showBrowser, goHeadless) remain unchanged for backward compatibility — migration is per-connector.

Status update (2026-04-20)

What the OpenSpec change covers

openspec/changes/redesign-connector-interaction-api/ validates with openspec validate ... --strict. It captures:

  • Why the three-API status quo (throw / return value / silent poll) is a design problem and how InteractionResult fixes it.
  • Per-runtime skip semanticsvana-connect and data-connect skip on --no-input with reason: "no-input"; context-gateway always skips with reason: "no-headed-browser" because it never surfaces a headed browser.
  • Strict runtime-first rollout order — no connector migration can merge until all three runtimes (vana-connect, data-connect, context-gateway) have shipped the new methods, otherwise migrated connectors throw TypeError at runtime.
  • Task list covering all four repos: this repo, vana-com/data-connect, vana-com/context-gateway, vana-com/data-connectors (plus PR feat(connect): refine user-facing connect flows #46's connector migrations).
  • Retirement plan for legacyAuthTriggered and CG's promptUser-throw after migrations complete.

Context (original investigation)

Investigated a bug where vana status showed "needs login" for ChatGPT when the session was valid. Root cause was a connector bug (checking login on about:blank), fixed in vana-com/data-connectors#44. But the investigation revealed deeper design issues:

  • Three interaction APIs with inconsistent --no-input semantics (throw vs return value vs silent no-op)
  • The runtime emitting legacy-auth events that the CLI treated as terminal outcomes mid-run
  • Prior art research (OAuth Device Flow, MSAL, Terraform, Temporal) consistently shows "user needed" should be a return value, not an exception

The new APIs follow a consistent contract: always return a result object, never throw for expected states, let the connector decide what to do.

Test plan

  • All existing tests pass
  • Integration test with a connector using requestData in --no-input mode (tracked as task 1.5 in the OpenSpec plan)
  • Integration test with a connector using requestManualAction in --no-input mode (tracked as task 1.6)
  • Follow-up: migrate connectors in vana-com/data-connectors to new APIs — blocked until all three runtimes have shipped

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 27, 2026

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

Project Deployment Actions Updated (UTC)
connect Ready Ready Preview Apr 20, 2026 7:24pm

Request Review

@tnunamak tnunamak marked this pull request as draft March 28, 2026 09:17
tnunamak added a commit that referenced this pull request Apr 20, 2026
…#111)

## Summary

Two independent runtime bug fixes, extracted from #102 so they can ship
without waiting on the interaction-API redesign.

- **`goHeadless()` navigates to `https://chatgpt.com/`** after reopening
the headless context (line 811 on `main`). Every connector using
`goHeadless()` — oura, spotify, github, etc. — incurs an unnecessary
network roundtrip to `chatgpt.com` and leaks ChatGPT-specific state into
unrelated sessions. Change to `about:blank`.
- **`legacyAuthTriggered` silently discards valid results.** When
`showBrowser()` or `promptUser()` is called in `--no-input` mode and the
connector still manages to collect data (e.g. from cached cookies), the
post-run gate at line 358 drops the result. Remove the gate. The flag
stays — it still deduplicates `legacy-auth` events in
`showBrowser`/`promptUser`.

## Why split from #102

#102 bundles these fixes with the `requestData` / `requestManualAction`
API redesign. The redesign is the right direction but needs coordinated
rollout across four repos (this one, `data-connect`, `context-gateway`,
`data-connectors`). These two fixes help every connector user today and
don't depend on any of that.

See also: `data-connect` companion PR for the same `goHeadless →
about:blank` fix in `playwright-runner/index.cjs`.

## Test plan

- [ ] CI green
- [ ] `npx vana collect oura --no-input --json` — verify no stray
`chatgpt.com` request in the headless phase
- [ ] `npx vana collect chatgpt --no-input --json` — verify a valid
session still returns a clean result (the previously-discarded path)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
tnunamak added a commit to vana-com/data-connect that referenced this pull request Apr 20, 2026
## Summary

`goHeadless()` in `playwright-runner/index.cjs` navigated to
`https://chatgpt.com/` after reopening the headless context (line 739).
Every connector using `goHeadless()` — oura, spotify, github, etc. —
incurs an unnecessary network roundtrip to `chatgpt.com` and leaks
ChatGPT-specific state into unrelated sessions. Change to `about:blank`.

Same copy-paste bug exists in `vana-connect`'s `in-process-run.ts`;
fixed in companion PR vana-com/vana-connect#111. The two runtimes don't
share code, so the fix has to land in both.

Extracted from the interaction-API redesign work
(vana-com/vana-connect#102) so it can ship independently.

## Test plan

- [ ] CI green
- [ ] Run a non-ChatGPT connector in the desktop app (e.g. oura) through
the headless-switch path, verify no stray `chatgpt.com` request

🤖 Generated with [Claude Code](https://claude.com/claude-code)
tnunamak and others added 4 commits April 20, 2026 14:18
Bug fixes:
- goHeadless() navigated to https://chatgpt.com/ instead of about:blank,
  causing an unnecessary network roundtrip for every connector
- legacyAuthTriggered flag silently discarded valid connector results when
  showBrowser() was called in --no-input mode but the connector still
  collected data from cached cookies

New APIs (old APIs remain unchanged for backward compatibility):

requestData(schema) — like requestInput but returns a result object instead
of throwing in --no-input mode:
  { status: 'success', data } or { status: 'skipped', reason: 'no-input' }

requestManualAction(message, checkFn, options?) — merges showBrowser +
promptUser + goHeadless into one call. Returns:
  { status: 'success' } or { status: 'skipped', reason: 'no-input' }
No legacy-auth event emitted; the connector decides what to do with a skip.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Guard against skip results being persisted as collected data if a
  connector accidentally returns a requestData/requestManualAction result
- Extract collectInput helper to deduplicate requestInput/requestData
- Remove redundant nullish coalescing in collectInput
- Match log prefixes to existing [prompt] convention
Match both status === "skipped" AND reason === "no-input" to avoid
suppressing legitimate connector data that happens to have a "status"
field. Flagged by Codex review.
Adds the OpenSpec change proposal covering the full rollout of the
requestData / requestManualAction contract across vana-connect,
data-connect, context-gateway, and data-connectors.

Captures the rationale, the per-runtime skip semantics (no-input vs
no-headed-browser), the strict runtime-first rollout order, and the
tasks required to retire the old four-method surface.

Validated with `openspec validate redesign-connector-interaction-api
--strict`.
@tnunamak tnunamak force-pushed the feat/interaction-api-redesign branch from 3d6eb93 to 5f3c748 Compare April 20, 2026 19:23
@tnunamak tnunamak changed the title feat: redesign runtime interaction APIs feat(runtime): add requestData and requestManualAction APIs (design spec inside) Apr 20, 2026
@tnunamak
Copy link
Copy Markdown
Member Author

Force-pushed an update. Two changes on top of the previous PR state:

  1. Rebased onto current main, which now contains the two runtime bug fixes (goHeadless → about:blank and the legacyAuthTriggered result-discard removal). Those shipped separately as fix(runtime): goHeadless about:blank + drop legacyAuth result-discard #111. This PR no longer carries them.
  2. Added an OpenSpec change proposal at openspec/changes/redesign-connector-interaction-api/ with the full four-repo rollout plan. Validates with openspec validate --strict.

See the updated PR description for the detailed status and what's covered in the plan.

vana-connect-release-bot Bot pushed a commit that referenced this pull request Apr 20, 2026
## [0.13.2](v0.13.1...v0.13.2) (2026-04-20)

### Bug Fixes

* **runtime:** goHeadless about:blank + drop legacyAuth result-discard ([#111](#111)) ([d192852](d192852)), closes [#102](#102) [#102](#102)
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