Skip to content

feat(platform): inject restart context system message (#19 Layer 1) - #65

Merged
HongmingWang-Rabbit merged 1 commit into
mainfrom
fix/issue-19-restart-context-layer1
Apr 14, 2026
Merged

feat(platform): inject restart context system message (#19 Layer 1)#65
HongmingWang-Rabbit merged 1 commit into
mainfrom
fix/issue-19-restart-context-layer1

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Resolves #19 partially — Layer 1 (platform-managed context) only. Layer 2 (user restart_prompt) deferred to a follow-up issue.

Change

After workspace restart and re-registration, platform sends an A2A message/send to the workspace as a synthetic user message containing:

  • restart timestamp
  • previous session end timestamp + duration
  • env-var keys now available (keys only, no values)

Covers both the HTTP POST /workspaces/:id/restart path and the programmatic RestartByID path (auto-restart after secret change, container death, liveness timeout).

Metadata on the A2A message:
```
"metadata": { "kind": "restart_context", "source": "platform", "layer": 1, "restart_context": true }
```

Skip path

If the workspace doesn't come back online within 30s, log and drop. Restart response is unaffected.

Safety

  • Values are NEVER included in the rendered message — only keys.
  • System caller prefix `system:restart-context` bypasses access control and caller-token check.

Test plan

  • `go build ./... && go vet ./...` pass
  • `go test -race ./...` pass
  • new unit tests cover humanDuration, message render (with + without prior session), and JSON-RPC payload shape
  • tests/e2e/test_api.sh — skipped locally (requires running platform + Postgres); CI will run

🤖 Generated with Claude Code

After a workspace restart (HTTP /restart or programmatic RestartByID) and
re-registration, the platform sends a synthetic A2A message/send to the
workspace containing:
- restart timestamp
- previous session end timestamp + human duration
- env-var keys now available (keys only — never values)

The message is rendered in the format proposed in #19 and marked with
metadata.kind=restart_context so agents can detect and handle it
specifically if they choose.

Skip path: if the workspace doesn't re-register within 30s, log and drop.
The Restart HTTP response is unaffected by delivery success.

Layer 2 (user-defined restart_prompt via config.yaml / org.yaml) is
deferred — tracked as a separate follow-up issue.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit marked this pull request as ready for review April 14, 2026 19:41
@HongmingWang-Rabbit
HongmingWang-Rabbit merged commit 3ea8cda into main Apr 14, 2026
7 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the fix/issue-19-restart-context-layer1 branch April 14, 2026 19:48
@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor Author

Merged. noteworthy: access-control-bypass — introduces system:restart-context caller prefix that bypasses CanCommunicate + A2A token validation (via existing systemCallerPrefixes allowlist in a2a_proxy.go:72). Bypass is principled (reuses existing system: scheme, not novel). 7/7 gates passed, 0 critical findings. Cross-vendor review unavailable (codex tier / gemini quota). Post-merge HEAD: 3ea8cda.

HongmingWang-Rabbit pushed a commit that referenced this pull request Apr 14, 2026
#65)

- edit-history/2026-04-14.md: append tick-4 section covering the 12
  modular guardrail plugins (#63), global-secrets auto-restart fan-out
  (#64, fixes issue #15), and synthetic restart-context A2A message
  (#65, fixes issue #19 Layer 1; Layer 2 deferred to issue #66).
- CLAUDE.md: bump Go test count 699 -> 726 (measured); note global
  secrets auto-restart on SetGlobal/DeleteGlobal in the route table;
  add Workspace Lifecycle paragraph for the restart-context message
  and its system:restart-context caller prefix.
- PLAN.md: bump Go test count in the coverage table; record issues
  #15 and #19 Layer 1 as launched; add new Backlog entry for the
  Layer 2 follow-up (issue #66).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit added a commit that referenced this pull request Apr 14, 2026
docs: sync documentation with 2026-04-14 evening-tick merges (#63, #64, #65)
HongmingWang-Rabbit pushed a commit that referenced this pull request Apr 14, 2026
Backlog items 11-14 used sequential enumeration (#64/#65/#66/#67) as
intra-doc bookkeeping. Those numbers now collide with actual merged
PRs and open issues with completely different scopes:
  - PR #64 = auto-refresh global_secrets (not "delegations list")
  - PR #65 = restart context Layer 1 (not "per-agent repo access")
  - Issue #66 = restart_prompt Layer 2 (not "SDK swallows stderr")
  - PR #67 = docs sync tick-4 (not "MCP localhost default")

Strip the misleading refs and add a footnote explaining the cleanup.
If/when any of these items get prioritized, file real GitHub issues.

Tracked in cron-learnings tick-3 entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
molecule-ai Bot pushed a commit that referenced this pull request Apr 21, 2026
…layer1

feat(platform): inject restart context system message (#19 Layer 1)
molecule-ai Bot pushed a commit that referenced this pull request Apr 21, 2026
#65)

- edit-history/2026-04-14.md: append tick-4 section covering the 12
  modular guardrail plugins (#63), global-secrets auto-restart fan-out
  (#64, fixes issue #15), and synthetic restart-context A2A message
  (#65, fixes issue #19 Layer 1; Layer 2 deferred to issue #66).
- CLAUDE.md: bump Go test count 699 -> 726 (measured); note global
  secrets auto-restart on SetGlobal/DeleteGlobal in the route table;
  add Workspace Lifecycle paragraph for the restart-context message
  and its system:restart-context caller prefix.
- PLAN.md: bump Go test count in the coverage table; record issues
  #15 and #19 Layer 1 as launched; add new Backlog entry for the
  Layer 2 follow-up (issue #66).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
molecule-ai Bot pushed a commit that referenced this pull request Apr 21, 2026
docs: sync documentation with 2026-04-14 evening-tick merges (#63, #64, #65)
molecule-ai Bot pushed a commit that referenced this pull request Apr 21, 2026
Backlog items 11-14 used sequential enumeration (#64/#65/#66/#67) as
intra-doc bookkeeping. Those numbers now collide with actual merged
PRs and open issues with completely different scopes:
  - PR #64 = auto-refresh global_secrets (not "delegations list")
  - PR #65 = restart context Layer 1 (not "per-agent repo access")
  - Issue #66 = restart_prompt Layer 2 (not "SDK swallows stderr")
  - PR #67 = docs sync tick-4 (not "MCP localhost default")

Strip the misleading refs and add a footnote explaining the cleanup.
If/when any of these items get prioritized, file real GitHub issues.

Tracked in cron-learnings tick-3 entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
…e required_env from registry (proper SSOT, task #65)' (#2182) from feat/google-adk-platform-provider-mirror-ssot into main
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.

Workspace restart context — platform-generated state snapshot + optional restart_prompt

1 participant