Repository navigation
feat: implement scope organization runtime for RFC #1345 - #1401
Conversation
There was a problem hiding this comment.
license-eye has checked 978 files.
| Valid | Invalid | Ignored | Fixed |
|---|---|---|---|
| 704 | 21 | 253 | 0 |
Click to see the invalid file list
- integrations/codex/plugins/powercontext/hooks/bind_tools.py
- integrations/codex/plugins/powercontext/hooks/session_binding.py
- integrations/codex/plugins/powercontext/scripts/scope_binding.py
- src/powercontext/builtin/handoff_report/init.py
- src/powercontext/builtin/handoff_report/adapters.py
- src/powercontext/builtin/handoff_report/canonical.py
- src/powercontext/builtin/handoff_report/errors.py
- src/powercontext/builtin/handoff_report/protocols.py
- src/powercontext/builtin/handoff_report/rendering.py
- src/powercontext/builtin/scope/init.py
- src/powercontext/builtin/scope/application.py
- src/powercontext/builtin/scope/errors.py
- src/powercontext/builtin/scope/models.py
- src/powercontext/builtin/scope/repository.py
- src/powercontext/server/static/handoff-report.js
- src/powercontext/server/static/scope-selection.js
- src/powercontext/server/templates/pages/handoff_report.html
- tests/builtin/test_scope_application.py
- tests/codex_plugin/test_scope_binding.py
- tests/test_handoff_report.py
- tests/test_scope_api.py
Use this command to fix any missing license headers
```bash
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
</details>
POWERCONTEXT: AGENT <-> SCOPE INTERACTION MAPA Scope is server-owned. Agent, session, workspace, repository, SCENARIO 1: NEW AGENT SESSIONFirst prompt: SCENARIO 2: RESUME OR REUSE AN EXISTING SCOPEResume the same session: Start a new session with a workspace binding: Explicitly reuse or switch to Scope Y: Next request uses Scope Y: SCENARIO 3: CREATE A NEW ISOLATED SCOPEExplicit switch: SCENARIO 4: MULTIPLE AGENTSShare all state: Both sessions are bound separately to Scope X. Shared inside Scope X:
Isolate independently continuable work: Create children: Parent means organization only. It does not inherit or share data. SCENARIO 5: READ FROM OR DELIVER ACROSS SCOPESDirect Context Reference: Deliver one accepted result: Publication copies only the selected Artifact revision. KEY RULES
|
907b730 to
605701b
Compare
|
resolve conflicts |
…1723) * fix(evaluation): register a Scope for each arm before running Codex Since #1401 the Server generates Scope IDs and rejects an explicit Scope that does not exist. The console still passed the literal `eval:{run_id}:{arm}` to the Codex plugin, so its UserPromptSubmit hook got a 404 while resolving the Scope and exited without capturing or recalling. The ON arm then behaved like the OFF arm and failed treatment validation. Each arm now creates its Scope through `POST /v1/scopes` once the Server is ready, using `eval:{run_id}:{arm}` as the idempotency key, and passes the returned ID to Codex. The evidence query and treatment validation use that ID, and the evidence records the key as `scope_key` so reports can tie it to the run. Evidence recorded before this change carries the key as its Scope ID and still validates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(evaluation): reject an empty scope key in report evidence The report loader accepted `scope_key=""` and, because the check used `or`, fell back to `scope_id` as if the evidence predated per-arm Scopes. The harness never writes an empty key, since its own evidence model rejects one, but the report layer re-validates stored evidence independently and should enforce the same rule. Only an absent key now selects the earlier format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(evaluation): accept the scope key in console treatment evidence The console parses treatment evidence with a strict schema, and the API now returns `scope_key` for every run: `null` for evidence recorded before arms registered their own Scope, and the run arm key otherwise. Without the field in the schema, the console rejected the evidence of every report, including earlier runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(evaluation): retry an arm whose Scope the Server did not create Scope creation is part of preparing the Server for an arm, like the readiness gate, but its failure was raised as a plain invalid treatment, which the worker treats as terminal. A transient failure now raises a readiness failure with its own reason, so the task is retried with a fresh runtime. Also rename the key helper to `arm_scope_key`, so it no longer reads like the evidence field of the same name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Which issue or RFC does this PR close?
Implements the runtime design in #1345.
Rationale for this change
Scope is the durable boundary for memory ownership, isolation, sharing, and reporting. The runtime and Agent integrations need to use the same server-owned Scope model instead of Project, Workstream, or client-generated Scope identifiers.
What changes are included in this PR?
Are there any user-facing changes?
Yes. This is a breaking change:
How was this change tested?
make checkmake testmake contract-testmake docs-testmake harness-checkAI usage statement
OpenAI Codex was used for code analysis, implementation, tests, and documentation editing.