Skip to content

test(pi): run the Pi extension against a real Server in CI - #2531

Merged
hidb4ai merged 1 commit into
oceanbase:masterfrom
Fengzdadi:test/pi-service-chain
Nov 10, 2026
Merged

hidb4ai merged 1 commit into
oceanbase:masterfrom
Fengzdadi:test/pi-service-chain

Conversation

@Fengzdadi

Copy link
Copy Markdown
Collaborator

Which issue or RFC does this PR close?

No tracking issue. This is the Pi counterpart of the real-host coverage tracked for Hermes in #2438 and for the gateway in #2466.

Rationale for this change

The Pi package's own tests stub fetch and Pi's extension API. The cross-host continuity acceptance runs the actual Pi host against a real Server, but only to send a Handoff with prompt capture off. It does not check recall, prompt capture, lifecycle checkpoints, or the memory tools. A break between Pi's lifecycle events, the extension, and the Server's HTTP contract in any of those would reach users first.

What changes are included in this PR?

  • tests/e2e/test_pi_service_chain.py starts three things:

    • Pi in RPC mode, with the package's extension loaded through -e and a pinned Scope.
    • An in-process Server (SQLite, bearer auth, no memory schedule).
    • Deterministic fixtures for Pi's model and for the Server's generation model.

    It covers four cases:

    • Recall across sessions: a prompt from one Pi session is recalled in the next one.
      • Only the extension's lifecycle flush can extract it, because the Server runs no schedule.
      • A prompt carrying a credential is not captured, and the credential reaches neither the Server nor the generation model.
      • The next session's first model call carries the Server's prepared content unchanged, after the PowerContext host-supplied context. label. This holds both before and after fix(pi): drop the adapter trust notice from prompt context #2510.
    • Compaction checkpoint: after an agent_end flush meets a 503, the position stays pending, and compact flushes it before Pi finishes compacting.
    • Stalled compaction checkpoint:
      • A held flush ends at the one-second boundary budget rather than the 30-second request timeout, and the position stays pending.
      • The deadline_exceeded diagnostic names session_before_compact without content or the raw Scope ID.
      • new_session then flushes the position.
    • Explicit writes: Pi asks the user to confirm pc_remember.
      • A declined write leaves nothing behind.
      • A confirmed write stores the entry, and pc_search returns it from the bound Scope.
  • PiHost.prompt(..., allow_tool_errors=True) lets a case observe a declined tool call. Existing callers keep the strict default.

  • CI:

    • The pi-package job runs the file with POWERCONTEXT_TEST_PI_HOST=1, so missing Pi dependencies fail the job instead of skipping.
    • .github/ci-paths.toml routes the shared Pi RPC client and the ZCode acceptance fixtures the test uses to the pi suite.

Are there any user-facing changes?

No. Tests and CI only.

How was this change tested?

  • POWERCONTEXT_TEST_PI_HOST=1 uv run pytest tests/e2e/test_pi_service_chain.py: 4 passed, in 10–27 s per run. This includes runs with three concurrent -n 4 invocations.
    • Flushes that reached the Server took 32–64 ms when run alone, and at most 160 ms under that load, against the one-second budget.
    • The stalled checkpoint ended after 1.01 s.
  • Each of 11 small mutations of the extension fails at least one case:
    • no pre-compaction flush
    • closing budget removed
    • closing budget stretched to five seconds
    • failed flush drops the pending position
    • capture ignores credentials
    • recall query not scrubbed
    • captured position never recorded
    • recalled content not injected
    • recalled content not labeled
    • remember skips confirmation
    • tools ignore the bound Scope
  • With fix(pi): drop the adapter trust notice from prompt context #2510's recall.ts change applied locally, all 4 cases pass.
  • Without the Pi dependencies the cases skip; with POWERCONTEXT_TEST_PI_HOST=1 they fail.
  • uv run pytest tests/test_ci_changes.py: 112 passed.
  • make check: passed.
  • make unit-test on macOS: 8141 passed, 416 skipped, 4 failed. All four are in tests/test_ci_installation_roles.py, the known macOS failures, which this PR does not touch.
  • Self-review: Claude Code /code-review (high) before and after the review changes, plus an independent review agent. None found a correctness defect.
    • Changes from the reviews:
      • The compaction test is split into its two scenarios.
      • The stalled-checkpoint bound is 3 s, not 10 s, so a five-second budget now fails.
      • The declined write asserts that Pi requested confirmation.
      • The recall case asserts the label.
      • The docstring and the CI step name the extension rather than the package.
      • When a timed checkpoint fails, the message lists the boundaries that missed their budget, read only from complete diagnostic lines.
    • Left as is:
      • The Pi models.json block is duplicated with the cross-host runner. Consolidating it needs the ZCode acceptance to verify.
      • Only the fixture modules the test uses are routed to pi. An import error in the others still surfaces in the tests job's e2e collection.
  • Not validated:
    • No live model ran (fixtures only).
    • The pi-package job has not run this file yet.
    • Package installation, bundled skills, and Scope resolution are outside these cases.
    • The cross-host continuity acceptance needs a managed ZCode install and did not run locally. The PiHost change keeps its default, and this PR's routing selects that acceptance in CI.

AI usage statement

This PR was prepared with Claude Code (Claude Opus 5.5). It traced the Pi extension lifecycle, wrote the test and CI wiring, ran the checks, mutations, and reviews, and drafted this description. I reviewed the changes and the results.

Start Pi in RPC mode with the package's extension, an in-process Server,
and deterministic model fixtures. Cover cross-session recall, credential
prompts kept out of capture, the pre-compaction checkpoint when its flush
succeeds and when it stalls past the one-second budget, and memory writes
gated on user confirmation. Run the file in the pi-package job with
POWERCONTEXT_TEST_PI_HOST=1 and route the shared fixtures it uses to the
pi suite.
Copilot AI balanced review requested due to automatic review settings November 7, 2026 05:07

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@hidb4ai hidb4ai 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.

Reviewed 4ad405c. No patch-introduced correctness issues found. The real Pi/Server coverage is appropriately scoped, and this change adds no database tables or public product interfaces.

The separate OceanBase Recall effort job hit its 600-second maintenance-test timeout (exit 124), leaving the overall CI result red. That path is outside this patch; please resolve or obtain a successful rerun before merging.

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@AlexStocks AlexStocks added the 1.5.2 v1.5.2 release tracking label Nov 9, 2026

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@hidb4ai
hidb4ai merged commit e23d186 into oceanbase:master Nov 10, 2026
217 of 219 checks passed
jackie-cqz added a commit to jackie-cqz/powercontext that referenced this pull request Nov 11, 2026
Bring in the 6 first-parent commits that landed since the previous merge,
including the OpenDAL fix for the Pydantic diagnostic that failed
`opendal-package` on this branch and on master (oceanbase#2503), the Pi extension
tests against a real Server (oceanbase#2531), and the harness workflow restructuring
(oceanbase#2526).

The merge is textually clean. The persistence digest in
`release/upgrade-support.json` is unchanged. The new Pi service chain test
passed the removed `scheduler_path` argument to `create_server_app`, so that
argument is dropped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.5.2 v1.5.2 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants