Commit Graph

25 Commits

Author SHA1 Message Date
can1357 b3e0bde7b7 refactor(coding-agent): adjusted block resolution formatting and update tests
- Update hashline block resolution formatting to correctly incorporate anchor lines within operation labels.
- Fix and update test assertions and mock contexts across coding agent tests.
2026-07-31 20:55:37 +02:00
roboomp dd4985f31e fix(coding-agent): scoped subagent local root overrides
Keep subagent localProtocolOptions on their ToolSession instead of installing
them as the process-global LocalProtocolHandler override. No-context URL
consumers therefore retain the active top-level session's mapping while tan
and task subagents continue to resolve through their caller context.

Add SDK regression coverage proving subagent creation preserves an existing
global mapping.

Fixes #6971

(cherry picked from commit a02eef174b03036dc960c842a0901d22333ad9cd)
2026-07-29 23:08:44 +02:00
can1357 5d66eb7f2a Merge PR #5464: fix(coding-agent): persist vibe sessions across restarts (@roboomp) 2026-07-23 18:06:11 +02:00
roboomp 4bc68b45e2 fix(coding-agent): persisted vibe sessions across restarts
Vibe worker roster lived only in a process-local Map, so a resumed parent
session started with an empty registry and vibe_send failed with
"Unknown vibe session". Persist a versioned, parent-scoped lifecycle
journal (spawn/turn/tombstone events), rehydrate validated idle workers
through the persisted-subagent reviver on resume, and gate the flow with
generation/CAS protection so stale finalizers cannot clobber a
replacement worker. Killed transcripts stay readable but non-revivable;
mode-exit commits tombstones atomically with the mode change and rolls
back cleanly on storage failure.

Ported from @mastertyko's fork branch fix/vibe-session-persistence.

Fixes #5303
2026-07-14 17:58:14 +00:00
Mathews-Tom 331e7bea65 fix(secrets): restore keyed session placeholders 2026-07-11 21:59:50 +05:30
Mathews-Tom 8ccb560587 test(secrets): expect obfuscated assistant replay state 2026-07-02 03:51:13 +05:30
Mathews-Tom 49b91ed3e2 Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names
# Conflicts:
#	packages/coding-agent/test/sdk-session-isolation.test.ts
2026-06-27 21:01:41 +05:30
oldschoola a2854ba768 fix: migrate coding-agent tests from fs.rm to removeWithRetries
Migrate 203 test files (356 call sites) from fs.rm/fs.rmSync to
removeWithRetries/removeSyncWithRetries to reduce EBUSY test failures
on Windows. removeWithRetries is now exported from @oh-my-pi/pi-utils.

The migration uses a regex-based approach that:
- Replaces fs.rm(path, { recursive, force }) → removeWithRetries(path)
- Replaces fs.rmSync(path, { recursive, force }) → removeSyncWithRetries(path)
- Replaces fs.rm(path) → removeWithRetries(path) (no options)
- Skips fs.rm/fs.rmSync inside template literals (bun --eval scripts)
- Adds imports to existing @oh-my-pi/pi-utils import or creates new one
- Removes unused fs imports where fs.rm was the only fs usage (4 files)
2026-06-23 15:28:05 -07:00
Mathews-Tom 6050ddeaf0 fix(secrets): redact a pre-existing placeholder key when no effective secrets
The key-creation fix still built the obfuscator from allEntries when those
entries were all ineffective (e.g. only ignored short plain secrets), so a
pre-existing secret-placeholder.key was left unredacted (hasSecrets() false
disables obfuscation) and a tool read shipped the reusable HMAC key. Gate
the redaction-only obfuscator on hasSecrets() instead of allEntries.length:
whenever a persisted key exists but no configured entry produced an active
secret, build the key-redaction-only obfuscator so the key file is redacted.
2026-06-22 20:43:40 +05:30
Mathews-Tom c11fdd20da Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names
# Conflicts:
#	packages/coding-agent/src/prompts/system/system-prompt.md
#	packages/coding-agent/test/sdk-session-isolation.test.ts
2026-06-19 20:00:23 +05:30
can1357 d46bd0139b refactor(coding-agent): fixed system prompt customization path
- Fixed `SYSTEM.md` integration to correctly include custom-rendered sections like rules and skills.
- Consolidated system prompt validation by requiring `<skills>` tag presence instead of specific prose.
- Removed redundant system prompt math-formatting tests and orphaned task batch documentation tests.
2026-06-19 16:16:37 +02:00
Mathews-Tom 5989c52375 Store secret placeholder keys under agent dir 2026-06-18 23:41:21 +05:30
Mathews-Tom 7d8b7a7e52 Address secret placeholder review feedback 2026-06-18 23:08:00 +05:30
Mathews-Tom 1a6e149102 Redact existing placeholder keys without secrets 2026-06-17 22:22:34 +05:30
Mathews-Tom de8d81e278 Tighten secret placeholder redaction 2026-06-17 22:06:14 +05:30
Mathews-Tom e9d9eba33e Update secret redaction guidance assertion 2026-06-17 21:45:49 +05:30
Mathews-Tom 3b1277fbb6 Skip placeholder key fetch for replace-only secrets
getSecretPlaceholderKey() (which creates a key file under the config root) is
only needed for reversible obfuscate-mode placeholders. A replace-only secrets
set in a headless run with an unwritable config root failed startup for a
feature it never uses. Only request the key when an obfuscate-mode entry
exists.
2026-06-16 21:22:34 +05:30
Mathews-Tom 2d53465ad7 Key secret placeholders to a private digest 2026-06-16 10:24:13 +05:30
can1357 1b9d9d0851 refactor(catalog)!: split model catalog from pi-ai
Move bundled models, model cache/manager, thinking metadata, effort helpers,
provider descriptors/discovery, wire constants, and model identity utilities
into the new @oh-my-pi/pi-catalog package.

Update pi-ai to keep provider runtime/auth concerns, move catalog provider
metadata into CATALOG_PROVIDERS, and migrate coding-agent, agent, stats, docs,
and tests to import catalog values from pi-catalog.

Split coding-agent model registry helpers into discovery, roles, and models
config modules while preserving registry orchestration.

BREAKING CHANGE: @oh-my-pi/pi-ai no longer exports catalog subpaths such as
/models, /model-cache, /model-manager, /model-thinking, /effort,
/provider-models*, discovery helpers, and provider wire constants; use the
matching @oh-my-pi/pi-catalog subpaths instead.
2026-06-10 04:06:57 +02:00
can1357 20d19e8002 test: replaced blind sleeps with shared fixtures and condition polling
- Shared immutable model registries and auth storage via beforeAll/afterAll.
- Swapped fixed-delay settle sleeps for predicate polling and signals.
- Stubbed network/timers to drop wall-clock waits in registry and history tests.
- Added resetDisplay invalidation tests and startup-timing breakdown lines.
2026-06-06 22:09:04 +02:00
can1357 77f04c61bc test(coding-agent): join systemPrompt array before substring assertions 2026-05-04 18:06:12 +02:00
can1357 820776d0cc test(coding-agent): align prompt wording assertions 2026-04-23 23:05:24 +02:00
can1357 3d29a48e7a fix(coding-agent): fixed memory leak by cancelling idle compaction
- Fixed memory leak by cancelling idle compaction timer on event controller disposal.
- Fixed session resumption to preserve last non-empty session when starting fresh.
- Fixed stash detection to use git ref resolution instead of output parsing for reliability.
- Fixed secret obfuscation to deobfuscate restored session messages locally while keeping LLM messages obfuscated.
- Fixed stash pop operation to preserve staged changes with --index flag after task branch merges.
- Changed idle compaction settings from enum to numeric type for flexible configuration.
2026-04-05 03:50:52 +02:00
maximhar e27ceb2f96 fix: persist MCP discovery tool selections across session lifecycle (#453)
* fix: persist MCP discovery selections across session lifecycle

* fix: restore MCP discovery state on branch switches

* fix: preserve explicit MCP baseline on old branch contexts

* fix(coding-agent): preserve cleared MCP selections on resume

* fix(coding-agent): isolate MCP defaults across session switches

* fix(coding-agent): preserve MCP defaults across outages

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-17 14:49:54 +01:00
can1357 9148ec01ec feat(session-manager): added optional sessionDir with multi-root migration support
- Made sessionDir parameter optional in SessionManager.create(), forkFrom(), continueRecent(), and list() methods with automatic default computation.
- Updated SessionManager.getDefaultSessionDir() to accept optional agentDir parameter for custom sessions root configuration.
- Changed SessionManager.list() signature to require cwd parameter as first argument with sessionDir now optional.
- Implemented multi-root session migration support by replacing global migration state with per-root tracking and extracting session directory encoding logic.
- Added resolveManagedSessionRoot() function to determine if session directory is managed and extract its root.
2026-03-16 16:06:04 +01:00